DB2 MERGE

MERGE INTO BOF_FI_EMPLOYEE_DATAS AS T 
     USING (select NVL(count(1),0) c from BOF_FI_EMPLOYEE_DATAS where  EMPLOYEE_NO =? and IS_DISABLE = '0') AS S
   ON T.EMPLOYEE_NO = ? and s.c>0
 WHEN MATCHED THEN UPDATE SET area=?,company=?,door_no=?,door_name=?,emp_name=?,job = ?,ex_level=? , is_disable=?
 WHEN NOT MATCHED  THEN INSERT  VALUES (SEQ_FI_EMPLOYEE_DATAS.nextval,?,?,?,?,?,?,?,?,0)
 ELSE IGNORE

你可能感兴趣的:(sql,DB,db2)