表关联更新语句:
场景:
表:
AM_APPROVE_LIST_LOG_SAMMY
AM_APPROVE_LIST_SAMMY
更新栏位:
EMP_ID, APPROVER_SEQUENCE, APPROVER_ID
关联栏位:
EMP_ID, APPROVER_ID
方法一:
UPDATE am_approve_list_log_sammy a
SET (a.emp_id, a.approver_sequence, a.approver_id) =
(SELECT b.emp_id, b.approver_sequence, b.approver_id
FROM am_approve_list_sammy b
WHERE b.emp_id = a.emp_id AND b.approver_id = a.approver_id)
WHERE EXISTS (SELECT 1
FROM am_approve_list_sammy c
WHERE c.emp_id = a.emp_id AND c.approver_id = a.approver_id)
方法二:(10g(含)以上版本才可以使用)
MERGE INTO gt$fm_form_field_import imp
USING fm_form_field fie
ON ( imp.field_name = fie.field_name
AND fie.form_kind = 'BQE.FORM.7'
AND fie.table_name = 'BQEFORM7')
WHEN MATCHED THEN
UPDATE
SET imp.description = fie.description,
imp.is_query = fie.is_query,
imp.is_default_value = fie.is_default_value,
imp.is_query_show = fie.is_query_show,
imp.is_form_show = fie.is_form_show,
imp.is_participant = fie.is_participant,
imp.is_mail_show = fie.is_mail_show
场景:
表:
AM_APPROVE_LIST_LOG_SAMMY
AM_APPROVE_LIST_SAMMY
更新栏位:
EMP_ID, APPROVER_SEQUENCE, APPROVER_ID
关联栏位:
EMP_ID, APPROVER_ID
方法一:
UPDATE am_approve_list_log_sammy a
SET (a.emp_id, a.approver_sequence, a.approver_id) =
(SELECT b.emp_id, b.approver_sequence, b.approver_id
FROM am_approve_list_sammy b
WHERE b.emp_id = a.emp_id AND b.approver_id = a.approver_id)
WHERE EXISTS (SELECT 1
FROM am_approve_list_sammy c
WHERE c.emp_id = a.emp_id AND c.approver_id = a.approver_id)
方法二:(10g(含)以上版本才可以使用)
MERGE INTO gt$fm_form_field_import imp
USING fm_form_field fie
ON ( imp.field_name = fie.field_name
AND fie.form_kind = 'BQE.FORM.7'
AND fie.table_name = 'BQEFORM7')
WHEN MATCHED THEN
UPDATE
SET imp.description = fie.description,
imp.is_query = fie.is_query,
imp.is_default_value = fie.is_default_value,
imp.is_query_show = fie.is_query_show,
imp.is_form_show = fie.is_form_show,
imp.is_participant = fie.is_participant,
imp.is_mail_show = fie.is_mail_show