Please find the sample code to update a table using case :
UPDATE TABLE1 MAIN
SET MAIN.CHAR_TO = (CASE WHEN MAIN.REG_TEMP = 'R'
AND MAIN.POSTAL2 IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE1' WHEN MAIN.REG_TEMP = 'R'
AND MAIN.POSTAL2 NOT IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE2' WHEN MAIN.REG_TEMP = 'S'
AND MAIN.POSTAL2 IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE3' WHEN MAIN.REG_TEMP = 'S'
AND MAIN.POSTAL2 NOT IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE4' WHEN MAIN.REG_TEMP = 'W'
AND MAIN.POSTAL2 IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE5' WHEN MAIN.REG_TEMP = 'W'
AND MAIN.POSTAL2 NOT IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE6' ELSE ' ' END )
WHERE MAIN.PROCESS_INSTANCE = %ProcessInstance
Where value1 to value6 varies based on the case statement.Here the CHAR_TO field is assigned different value based on the case statements.
UPDATE TABLE1 MAIN
SET MAIN.CHAR_TO = (CASE WHEN MAIN.REG_TEMP = 'R'
AND MAIN.POSTAL2 IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE1' WHEN MAIN.REG_TEMP = 'R'
AND MAIN.POSTAL2 NOT IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE2' WHEN MAIN.REG_TEMP = 'S'
AND MAIN.POSTAL2 IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE3' WHEN MAIN.REG_TEMP = 'S'
AND MAIN.POSTAL2 NOT IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE4' WHEN MAIN.REG_TEMP = 'W'
AND MAIN.POSTAL2 IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE5' WHEN MAIN.REG_TEMP = 'W'
AND MAIN.POSTAL2 NOT IN (
SELECT POSTAL
FROM TABLE2) THEN 'VALUE6' ELSE ' ' END )
WHERE MAIN.PROCESS_INSTANCE = %ProcessInstance
Where value1 to value6 varies based on the case statement.Here the CHAR_TO field is assigned different value based on the case statements.