Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

update set with inner join oracle

UPDATE 
(SELECT table1.value as OLD, table2.CODE as NEW
 FROM table1
 INNER JOIN table2
 ON table1.value = table2.DESC
 WHERE table1.UPDATETYPE='blah'
) t
SET t.OLD = t.NEW

or

UPDATE table1 SET table1.value = (SELECT table2.CODE
                                  FROM table2 
                                  WHERE table1.value = table2.DESC)
WHERE table1.UPDATETYPE='blah'
AND EXISTS (SELECT table2.CODE
            FROM table2 
            WHERE table1.value = table2.DESC);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #update #set #join #oracle
ADD COMMENT
Topic
Name
5+3 =