Good, this is what he asks me for a table emple-depart-presupuesto
We must ensure that the spending on salaries of a department does not exceed 50% of the current budget.
CREATE OR REPLACE TRIGGER SALARIO50
BEFORE INSERT OR UPDATE ON emple
FOR EACH ROW
DECLARE
V_SALARIO NUMBER(4);
V_PRESUPUESTO NUMBER(4);
BEGIN
SELECT SUM(SALARIO) INTO V_SALARIO
FROM emple
GROUP BY DEPT_No;
SELECT CANTIDAD INTO V_PRESUPUESTO
FROM PRESUPUESTO
WHERE DEPT_NO=:NEW.DEPT_NO;
IF V_SALARIO>V_PRESUPUESTO/2 THEN
RAISE_APPLICATION_ERROR (-20234, 'Has exedido del 50% del presupuesto de deste departamento');
END;
And the error he gives me is this:
LINE/COL ERROR
-------- -----------------------------------------------------------------
13/4 PLS-00103: Se ha encontrado el símbolo ";" cuando se esperaba uno
de los siguientes:
if