Skip to Main Content

Oracle Database Discussions

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!

Update multiple columns only when not null

Mr.D.Feb 17 2015 — edited Feb 17 2015

Hi,

I need to update multiple columns of the same table with a fixed value only when the column value is not null.

UPDATE   MYTAB

      SET COL1 = DECODE(COL1, NULL,NULL, 'MYFIXEDVALUE1'),

              COL2 = DECODE(COL2, NULL,NULL, 'MYFIXEDVALUE2'),

              COL3 = DECODE(COL3, NULL,NULL, 'MYFIXEDVALUE3');

have you some other method?

Database; 11.2

thank you

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2015
Added on Feb 17 2015
12 comments
1,751 views