Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. TABLE: ORDER_LOCK
  2. Name Null Type
  3. ---------------------- -------- ----------
  4. ORDER_ID NOT NULL NUMBER(10) [PRIMARY KEY]
  5. ORDER_REF_ID NUMBER(10) [UNIQUE KEY]
  6. ORDER_MSG_SENT NUMBER(1)
  7.  
  8.  
  9. merge into ORDER_LOCK al
  10. using ( select ? ORDER_REF_ID, ? ORDER_MSG_SENT from dual ) t
  11. on (al.ORDER_REF_ID = t.ORDER_REF_ID)
  12. when not matched then
  13. insert (ORDER_ID, ORDER_REF_ID, ORDER_MSG_SENT)
  14. values (ORDER_LOCK_SEQ.nextval, t.ORDER_REF_ID, t.ORDER_MSG_SENT)
  15.  
  16. merge into ORDER_LOCK al
  17. using ( select 1 ORDER_REF_ID, sysdate ORDER_MSG_SENT from dual ) t
  18. on (al.ORDER_REF_ID = t.ORDER_REF_ID)
  19. when not matched then
  20. insert (ORDER_ID, ORDER_REF_ID, ORDER_MSG_SENT)
  21. values (ORDER_LOCK_SEQ.nextval, t.ORDER_REF_ID, t.ORDER_MSG_SENT);
  22.  
  23. merge into ORDER_LOCK al
  24. using ( select 1 ORDER_REF_ID, sysdate ORDER_MSG_SENT from dual ) t
  25. on (al.ORDER_REF_ID = t.ORDER_REF_ID)
  26. when not matched then
  27. insert (ORDER_ID, ORDER_REF_ID, ORDER_MSG_SENT)
  28. values (ORDER_LOCK_SEQ.nextval, t.ORDER_REF_ID, t.ORDER_MSG_SENT);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement