Created
February 3, 2015 14:03
-
-
Save xtender/d55c18f7380d3a3310a4 to your computer and use it in GitHub Desktop.
Trigger -> call -> NO_DATA_FOUND
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SQL> create table xt_tab(i int); | |
| Table created. | |
| SQL> create or replace procedure xt_no_data_found(i int) as | |
| 2 begin | |
| 3 if i>0 then | |
| 4 raise NO_DATA_FOUND; | |
| 5 end if; | |
| 6 end; | |
| 7 / | |
| Procedure created. | |
| SQL> create or replace trigger xt_trg_no_data_found | |
| 2 before insert on xt_tab | |
| 3 for each row | |
| 4 call xt_no_data_found(:new.i) | |
| 5 / | |
| Trigger created. | |
| SQL> | |
| SQL> insert into xt_tab values(0); | |
| 1 row created. | |
| SQL> insert into xt_tab values(1); | |
| insert into xt_tab values(1) | |
| * | |
| ERROR at line 1: | |
| ORA-01403: no data found | |
| ORA-06512: at "XT_NO_DATA_FOUND", line 4 | |
| ORA-06512: at "XT_TRG_NO_DATA_FOUND", line 1 | |
| ORA-04088: error during execution of trigger 'XT_TRG_NO_DATA_FOUND' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment