Home > database >  If mysql is used to implement the merge into grammar should be what to write
If mysql is used to implement the merge into grammar should be what to write

Time:01-28

The merge into t5_prod_calendar using a
: (select: sys_date as workday, prod_code prod_code, : tano tano from dual) b
On (Amy polumbo rod_code=p. rod_code and a.t ano=b.t ano and a.s ys_date=b.w orkday)
The when matched then
Update the set
Anderson s_apply_date=: is_apply_date,
Anderson s_apply_ack_date=: is_apply_ack_date,
Anderson s_redeem_date=: is_redeem_date,
Anderson s_redeem_ack_date=: is_redeem_ack_date,
A. egal_code=: legal_code,
A.a pply_cfm_date=: apply_cfm_date,
A.r edeem_cfm_date=: redeem_cfm_date
When not matched then
Insert (
Tano,
Prod_code,
Sys_date
Is_subs_date,
Is_establish_date,
Is_value_date,
Is_apply_date,
Is_apply_ack_date,
Is_redeem_date,
Is_redeem_ack_date,
Is_register_date,
Is_convert_date,
Is_winding_date,
Is_pay_date,
Is_end_date,
Legal_code,
Apply_cfm_date,
Redeem_cfm_date
) values (
: tano,
: prod_code,
: sys_date
: is_subs_date,
: is_establish_date,
: is_value_date,
: is_apply_date,
: is_apply_ack_date,
: is_redeem_date,
: is_redeem_ack_date,
: is_register_date,
: is_convert_date,
: is_winding_date,
: is_pay_date,
: is_end_date,
: legal_code,
: apply_cfm_date,
: redeem_cfm_date
)

CodePudding user response:

On the duplicate key update
  • Related