MERGE INTO table A
USING DUAL
ON (DUAL.DUMMY IS NOT NULL AND A.PDT = ? AND A.RCD = ? AND A.ERI = ? )
WHEN MATCHED THEN
UPDATE SET A.RNO = NVL(?,' ')
,A.AME = ?
,A.ESC = ?
,A.ATE = ?
,A.INE = ?
,A.DAT = ?
,A.USR = ?
,A.DAT = ?
,A.USR = ?
WHEN NOT MATCHED THEN
INSERT (PDT, RCD, ERI,
RNO, AME, ESC,
ATE, INE, DAT,
USR, DAT, USR )
VALUES(?, ?, ?, NVL(?,' '), ?, ?, ?, ?, ?, ?, ?, ?)
--------------------------
MERGE INTO R_INTRO A
USING ( SELECT ? USER_PID FROM DUAL ) B
ON (A.USER_PID = B.USER_PID)
WHEN MATCHED THEN
UPDATE SET
INTRO_SELF1 = ?,
INTRO_SELF2 = ?,
INTRO_SELF3 = ?,
INTRO_SELF4 = ?,
USER_UPDATE = TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),
USER_GUBB = 'C'
WHEN NOT MATCHED THEN
INSERT (
USER_PID, INTRO_SELF1, INTRO_SELF2, INTRO_SELF3, INTRO_SELF4,
USER_ISDATE, USER_UPDATE, USER_GUBB
)
VALUES
(
B.USER_PID, ?, ?, ?, ?,
TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),
TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'), 'C'
)
USING DUAL
ON (DUAL.DUMMY IS NOT NULL AND A.PDT = ? AND A.RCD = ? AND A.ERI = ? )
WHEN MATCHED THEN
UPDATE SET A.RNO = NVL(?,' ')
,A.AME = ?
,A.ESC = ?
,A.ATE = ?
,A.INE = ?
,A.DAT = ?
,A.USR = ?
,A.DAT = ?
,A.USR = ?
WHEN NOT MATCHED THEN
INSERT (PDT, RCD, ERI,
RNO, AME, ESC,
ATE, INE, DAT,
USR, DAT, USR )
VALUES(?, ?, ?, NVL(?,' '), ?, ?, ?, ?, ?, ?, ?, ?)
--------------------------
MERGE INTO R_INTRO A
USING ( SELECT ? USER_PID FROM DUAL ) B
ON (A.USER_PID = B.USER_PID)
WHEN MATCHED THEN
UPDATE SET
INTRO_SELF1 = ?,
INTRO_SELF2 = ?,
INTRO_SELF3 = ?,
INTRO_SELF4 = ?,
USER_UPDATE = TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),
USER_GUBB = 'C'
WHEN NOT MATCHED THEN
INSERT (
USER_PID, INTRO_SELF1, INTRO_SELF2, INTRO_SELF3, INTRO_SELF4,
USER_ISDATE, USER_UPDATE, USER_GUBB
)
VALUES
(
B.USER_PID, ?, ?, ?, ?,
TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),
TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'), 'C'
)
'DataBase > Sql' 카테고리의 다른 글
[Sql] Oracle - 특정 컬럼의 comment알아내기 (0) | 2010.06.29 |
---|---|
[Sql] Oracle - 정규화 예제 (0) | 2010.06.07 |
[Sql] Oracle - Select시 자동 num 증가 (0) | 2010.03.12 |
[Sql] Oracle, msSql - 프로시저 소스 검색 (0) | 2009.09.18 |
[Sql] Oracle - 간단한 저장프로시저 (0) | 2009.09.18 |