WITH
TBL AS (
SELECT 1 ID,'으악' NAME FROM DUAL UNION ALL
SELECT 2 ID,'홍씨' NAME FROM DUAL UNION ALL
SELECT 5 ID,'김씨' NAME FROM DUAL
)
UPDATE ENDUSER A
SET USER_NAME = (
SELECT NAME
FROM TBL WHERE ID = A.USER_ID)
,INSERT_DATE = SYSDATE
WHERE EXISTS (
SELECT 1
FROM TBL WHERE ID = A.USER_ID)
;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | -- With 문은 Select 문 앞에 와야 합니다. UPDATE enduser a SET user_name = ( WITH tbl AS ( SELECT 1 id, '으악' name FROM dual UNION ALL SELECT 2, '홍씨' FROM dual UNION ALL SELECT 5, '김씨' FROM dual ) SELECT name FROM tbl WHERE id = a.user_id ) , insert_date = sysdate WHERE a.user_id IN (1,2,5) ; |