1. Writing a TRIGGER that basicly every time a sale IS over 100 it gives a 10% discount, but I keep getting errors AND hit a wall basicly , any help appeciated :)
  2.  
  3.  
  4. {code}
  5. CREATE OR REPLACE TRIGGER Date_Constraint_Trigger
  6. before INSERT ON Sales_book
  7. FOR EACH ROW
  8. declare
  9. discount exception;
  10.  
  11. begin
  12. IF (:new.Scost > 100 ) then
  13. raise discount;
  14. end IF;
  15. exception
  16.  
  17. when discount then
  18. UPDATE
  19. SET Sales_book.Scost = Sales_book.Scost * .9;
  20.  
  21.  
  22. dbms_output.put_line('Discount Added.');
  23.  
  24.  
  25. when others then rollback work;
  26. end;
  27.  
  28. {code}