create or replace
TRIGGER TR_T_PR_FARMACO
BEFORE INSERT ON T_PR_DIZ_FARMACO
FOR EACH ROW
BEGIN
IF LENGTH(:new.T_PR_DIZ_FARMACO_MINSAN) < 9 THEN RAISE_APPLICATION_ERROR(-20013,'La lunghezza del MINSAN deve essere di 9 cifre');
END IF;
END TR_T_PR_FARMACO;
When i try to insert in T_PR_DIZ_FARMACO wrongly, the trigger works, but with these errors:
Errore durante il salvataggio delle modifiche nella tabella "BMF"."T_PR_DIZ_FARMACO": Riga 2: ORA-20013: La lunghezza del MINSAN deve essere di 9 cifre ORA-06512: a "BMF.TR_T_PR_FARMACO", line 8 ORA-04088: errore durante esecuzione del trigger 'BMF.TR_T_PR_FARMACO' ORA-06512: a line 1
(Translated)
Error saving changes in table "BMF". "T_PR_DIZ_FARMACO": Line 2: ORA-20013: The length of the MINSAN must be 9 digits ORA-06512: to "BMF.TR_T_PR_FARMACO", line 8 ORA-04088: error while executing the trigger 'BMF.TR_T_PR_FARMACO' ORA-06512: a line 1