Skip to content

Instantly share code, notes, and snippets.

@xtender
Created February 3, 2015 14:03
Show Gist options
  • Select an option

  • Save xtender/d55c18f7380d3a3310a4 to your computer and use it in GitHub Desktop.

Select an option

Save xtender/d55c18f7380d3a3310a4 to your computer and use it in GitHub Desktop.
Trigger -> call -> NO_DATA_FOUND
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