I tried something like that and got the following error.
Keyword CASE not expected. Valid tokens: SET.
Looks you'll have to do something like
update jstone/docs00
set KEYWORD5 = case doctype2
when 'HEDGECONFIRMS' then KEYWORD1
when 'CONTRACTFORM' then xxx
etc.
end,
KEYWORD9 = case doctype2
when 'HEDGECONFIRMS' then KEYWORD2
when 'CONTRACTFORM' then xxx
etc.
end,
etc.
Caveat: I was using an old V5R4 system. Newer versions may have better
capability.
Have fun!
Richard
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Stone, Joel
Sent: Thursday, May 08, 2014 12:25 PM
To: Midrange Systems Technical Discussion
Subject: can sql CASE handle multiple column updates in a CASE statement?
update jstone/docs00
case doctype2
when 'HEDGECONFIRMS'
set KEYWORD5 = KEYWORD1,
KEYWORD9 = KEYWORD2,
KEYWORD8 = KEYWORD3,
KEYWORD1 = ' ',
KEYWORD2 = ' ',
KEYWORD3 = ' '
when 'CONTRACTFORM'
when 'AMENDMENTFORM'
Or must I use many CASE statements to do this?
Thanks!
______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs
Skyscan service.
For more information please visit
http://www.symanteccloud.com
______________________________________________________________________
--
As an Amazon Associate we earn from qualifying purchases.