Home » SQL & PL/SQL » SQL & PL/SQL » to update mulitple columns based on the multiple column values from other table (9i)
to update mulitple columns based on the multiple column values from other table [message #398654] Fri, 17 April 2009 01:38 Go to next message
mohannksr
Messages: 28
Registered: January 2009
Junior Member
hi,

i want to update multiple columns of a table
based on the columns values from other table.
i have to use the case exp too in that.

whether this is possible...?


UPDATE table1 SET column2 = temp_table.column2,
column3 = temp_table.column3,
column4 = CAST(temp_table.column4 AS date) FROM

( SELECT DISTINCT table2.column1, table2.column2, table2.column3, table2.column4
FROM table2 WHERE column4 IS NOT NULL AND column4 <> '' AND (length(column4) = 10 OR length(column4) = 23)
) AS temp_table

WHERE table1.column1 = temp_table.column1;

Re: to update mulitple columns based on the multiple column values from other table [message #398660 is a reply to message #398654] Fri, 17 April 2009 01:46 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is possible and there are examples of it in SQL Reference manual, UPDATE page.

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and use code tags.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel

[Updated on: Fri, 17 April 2009 01:47]

Report message to a moderator

Previous Topic: ORA-06508: problem
Next Topic: SQL use, one column row string value combine
Goto Forum:
  


Current Time: Sun Dec 04 18:43:56 CST 2016

Total time taken to generate the page: 0.09058 seconds