Posted By

wh0emPah on 04/02/10


Tagged


Versions (?)

azeraz


 / Published in: PL/SQL
 

  1. before INSERT OR UPDATE ON s_ord
  2. FOR each ROW DECLARE TYPE TYPE_COLL_PERS IS TABLE OF S_EMP%ROWTYPE;
  3. t_pers TYPE_COLL_PERS;
  4. v_credit_rating s_customer.credit_rating%TYPE;
  5. INTO t_pers
  6. FROM s_emp
  7. WHERE id = :NEW.sales_rep_id;
  8. SELECT credit_rating
  9. INTO v_credit_rating
  10. FROM s_customer
  11. WHERE id =:NEW.customer_id;
  12.  
  13. IF (t_pers.COUNT = 0 OR UPPER(t_pers(1).title) <> 'SALES REPRESENTATIVE') THEN
  14. RAISE_APPLICATION_ERROR(-20000,'ORDERMAKER MOET SALES REPRESENTATIVE ZIJN');
  15.  
  16. IF ((v_credit_rating <> 'GOOD' OR v_credit_rating <> 'EXCELLENT') AND :NEW.payment_type = 'CASH') THEN
  17. RAISE_APPLICATION_ERROR(-20000,'Klant kan alleen met cash betalen als zijn krediet goed of excellent is');
  18. END P6_1_ORD ;

Report this snippet  

You need to login to post a comment.