Advertisement
JUNIORCEDE1

Trigger nota entre 0 y 20

Jun 27th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.56 KB | None | 0 0
  1. CREATE OR REPLACE TRIGGER tr_b_i_nota
  2. BEFORE
  3. INSERT OR UPDATE ON matricula
  4. FOR EACH ROW
  5. DECLARE
  6. excep exception;
  7. BEGIN
  8.     IF (:NEW.nota_parcial1 < 0 OR :NEW.nota_parcial1 > 20) OR (:NEW.nota_parcial2 < 0 OR :NEW.nota_parcial2 > 20) THEN
  9.         raise excep;
  10.     END IF;
  11.     exception
  12.     WHEN excep THEN
  13.     RAISE_APPLICATION_ERROR(-20002, 'La nota ingresada no debe ser menor a 0 ni mayor a 20. La nota ingresada del primer parcial es : '
  14.     ||to_char(:NEW.nota_parcial1)||' La nota ingresada del segundo parcial es :'||to_char(:NEW.nota_parcial2));
  15. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement