1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| SQL> drop table t;
Table supprimee.
SQL> create table t (id number(10));
Table creee.
SQL> create trigger insert_employe
before insert on t
for each row
begin
if :NEW.id < 0then
raise_application_error (-20600, 'idnegatif');
end if;
end;
/ 2 3 4 5 6 7 8 9
Declencheur cree.
SQL> insert into t values (1);
1 ligne creee.
SQL> insert into t values (-1);
insert into t values (-1)
*
ERREUR a la ligne 1 :
ORA-20600: idnegatif
ORA-06512: a "SKUATAMAD.INSERT_EMPLOYE", ligne 3
ORA-04088: erreur lors d'execution du declencheur 'SKUATAMAD.INSERT_EMPLOYE'
SQL> select * from t;
ID
----------
1
SQL> insert into t values (2);
1 ligne creee.
SQL> select * from t;
ID
----------
1
2
SQL> rollback;
Annulation (rollback) effectuee.
SQL> select * from t;
aucune ligne selectionnee
SQL> begin
insert into t values (1);
insert into t values (-1);
insert into t values (2);
commit;
end; 2 3 4 5 6
7 /
begin
*
ERREUR a la ligne 1 :
ORA-20600: idnegatif
ORA-06512: a "SKUATAMAD.INSERT_EMPLOYE", ligne 3
ORA-04088: erreur lors d'execution du declencheur 'SKUATAMAD.INSERT_EMPLOYE'
ORA-06512: a ligne 3
SQL> select * from t;
aucune ligne selectionnee
SQL> |
Partager