Jump to content

Archived

This topic is now archived and is closed to further replies.

brianlange

oracle - update several columns to one value

Recommended Posts

In Oracle, how do I update several columns to one value?

 

This will work, but I am guessing there is a better way.

 

Update table 
set (col1, col2, col3) = 
(select val, val, val from dual)
where record_id = :record: id

 

 

Share this post


Link to post
Share on other sites

I'm also aware that I can write

update table 
set col1 = val,
     col2 = val
where id = :id

 

I was just curious if I can avoid repeating the value.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.