MERGE INTO T_MNG_ACNT t USING ( SELECT SVR_IP server, ACNT_NM acntnm, SVR_PORT port, DB_TYP dbtype, DB_NAME name, DB_USER dbuser, DB_PWD pwd FROM dual ) tmp ON (t.DB_USER = tmp.dbuser AND t.ACNT_NM = tmp.acntnm) WHEN MATCHED THEN UPDATE SET t.SVR_IP = tmp.server, t.SVR_PORT = tmp.port, t.DB_TYP = tmp.dbtype, t.db_name = tmp.name, t.DB_USER = tmp.dbuser, t.DB_PWD = tmp.pwd WHEN NOT MATCHED THEN insert(t.ACNT_ID, t.ACNT_NM, t.ACNT_DESC, t.SVR_IP, t.SVR_PORT, t.DB_TYP, t.DB_NAME, t.DB_USER, t.DB_PWD, t.USE_YN, t.DEL_YN, t.REG_DT, t.REG_ID, t.MOD_DT, t.MOD_ID) VALUES( (SELECT nvl(max(ACNT_ID),99)+1 FROM T_MNG_ACNT), 'test', 'test', 'test', 2017 , 'oracle', 'test', 'test', 'test', 'Y', 'N', SYSDATE, 0, SYSDATE, 0);
mertge into 를 처음 사용해 보는데요 SQL Error [904] [42000]: ORA-00904: "DB_PWD": 부적합한 식별자
에러가 뜨는데 t.db_pwd로 해줘도 안돼서 질문 드립니다 ㅠ
MERGE INTO t_mng_acnt t USING (SELECT 'test' db_user , 'test' acnt_nm , 'test' acnt_desc , 'test' svr_ip , 2017 svr_port , 'oracle' db_typ , 'test' db_name , 'test' db_pwd FROM dual ) tmp ON (t.db_user = tmp.db_user AND t.acnt_nm = tmp.acnt_nm) WHEN MATCHED THEN UPDATE SET t.svr_ip = tmp.svr_ip , t.svr_port = tmp.svr_port , t.db_typ = tmp.db_typ , t.db_name = tmp.db_name , t.db_pwd = tmp.db_pwd WHEN NOT MATCHED THEN INSERT ( acnt_id , acnt_nm , acnt_desc , svr_ip , svr_port , db_typ , db_name , db_user , db_pwd , use_yn , del_yn , reg_dt , reg_id , mod_dt , mod_id ) VALUES ( (SELECT NVL(MAX(acnt_id), 99) + 1 FROM t_mng_acnt) , tmp.acnt_nm , tmp.acnt_desc , tmp.svr_ip , tmp.svr_port , tmp.db_typ , tmp.db_name , tmp.db_user , tmp.db_pwd , 'Y' , 'N' , sysdate , 0 , sysdate , 0 ) ;