Skip to content

Instantly share code, notes, and snippets.

@hackvan
Created February 23, 2017 16:53
Show Gist options
  • Save hackvan/1f20c7bd042045bd7901cc3c45d55aa0 to your computer and use it in GitHub Desktop.
Save hackvan/1f20c7bd042045bd7901cc3c45d55aa0 to your computer and use it in GitHub Desktop.
How to create a custom exception for the use of CURRVAL on sequences.
Declare
nextvalnotfound Exception;
Pragma Exception_Init(nextvalnotfound, -08002);
lc_secuencia Number;
Begin
SELECT sfps010s.currval INTO lc_secuencia FROM dual;
Exception
When nextvalnotfound Then
dbms_output.put_line('NextVal is not found it!');
When Others Then
dbms_output.put_line('Error: ' || Sqlerrm);
End;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment