Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql oracle update multiple rows

UPDATE employee
   SET staff_no = 
           CASE depno
                WHEN 1 THEN 'ab123'
                WHEN 2 THEN 'ab321'
                --...
                ELSE staff_no
           END
 WHERE depno IN ( 1, 2 ) -- list all cases here. use a subquery if you don't want to / cannot enumerate
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #oracle #update #multiple #rows
ADD COMMENT
Topic
Name
4+2 =