Guest User

Untitled

a guest
Mar 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. create or replace TRIGGER MONITOR
  2. AFTER UPDATE OF status ON ACTION
  3. FOR EACH ROW
  4.  
  5. DECLARE
  6.  
  7. actiontype number(10,0);
  8. children number(10,0);
  9.  
  10.  
  11. BEGIN
  12. select code_id into actiontype FROM ACTION_TYPE
  13. WHERE ACTION_id =:new.ACTION_id
  14. AND projid = :new.projid
  15. AND code_id='xxxx';
  16.  
  17.  
  18.  
  19. IF actiontype=xxxx AND :old.status ='Active' AND :new.status='Finished'
  20.  
  21. THEN
  22.  
  23. select t.ACTION_id into chlidren from ACTION t left join ACTIONREL tp
  24. on t.ACTION_id=tp.ACTION_id
  25.  
  26. left join ACTIONactv tsk
  27. on tsk.ACTION_id=t.ACTION_id
  28.  
  29. left join project p
  30. on p.projid=t.projid
  31.  
  32.  
  33. where tp.pred_ACTION_id=:new.ACTION_id
  34. and t.status = 'TK_NotStart'
  35. and tsk.code_id='2679933'
  36. and TRUNC(TO_DATE (p.last_date, 'DD.MON.YYYY'))=TRUNC(TO_DATE (t.target_date, 'DD.MON.YYYY'));
  37.  
  38. IF children != NULL
  39. THEN
  40.  
  41.  
  42. UPDATE ACTION
  43. SET ACT_START_DATE=TARGET_START_DATE
  44. WHERE ACTION_ID= children;
  45. END IF;
  46. END IF;
Add Comment
Please, Sign In to add comment