Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Multi columns

User_7FAONApr 5 2022

Select * from employees;
AGE QUAL INCOME
---------- ---- ----------
19 Grad 5000
19 Grad 4000
19 Grad 3000
26 Grad 6000
26 Grad 5000
26 PosG 8000

Question : I want to update the QUAL Column data of 19th AGE only.

Update employees set(AGE, INCOME) =
Case
when AGE = 19 and Income = 5000 then QUAL= 'HTC'
WHEN AGE = 19 and Income = 4000 then QUAL = 'MI'
else
QUAL = 'HP'
/

Case
*
ERROR at line 2:
ORA-01767: UPDATE ... SET expression must be a subquery

Can anyone help me in resolving this query.

Comments

EdStevens

This really has nothing to do with SQL Developer (the subject of this forum). It is a much better fit in SQL & PL/SQL.
And just as a side comment, storing 'age' as data is a flawed design. The 'age' of everyone and every thing is increasing by the day, if not by the second. What is your plan to keep 'age' current? Better to store 'date of birth' and the calculate 'age' when needed at run-time.

User_H3J7U

The 'age' of everyone and every thing is increasing by the day, if not by the second.
Sometimes the age stops increasing.
изображение.png

EdStevens

Pour me one!
Of course, that's not actually the age, but the amount of time it was 'aged' in the barrel before bottling.

1 - 3

Post Details

Added on Apr 5 2022
3 comments
132 views