Multiple Updates

30 pts.
Tags:
Oracle
Oracle Table
Hi, is there a way to update a table as follows: update tabe_name set name=name1 where oldname=1 name=name2 where oldname=2 name =name3 where oldname=3; Thanks, Sam

Answer Wiki

Thanks. We'll let you know when a new response is added.

You could use the DECODE function.

Something like this:

<pre>UPDATE table_name
SET name = decode(oldname,1,name1,2,name2,3,name3)
WHERE oldname in (1,2,3);</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: