Skip to content

Instantly share code, notes, and snippets.

@hackvan
Created May 18, 2016 13:56
Show Gist options
  • Save hackvan/dd5f893f771559ee7493d7cd4df991a5 to your computer and use it in GitHub Desktop.
Save hackvan/dd5f893f771559ee7493d7cd4df991a5 to your computer and use it in GitHub Desktop.
PL/SQL Oracle: Ejemplo con el uso del "Pragma Exception_Init"
Create Or Replace Procedure do_something(pevc_codbanco In Varchar2) Is
row_locked Exception;
Pragma Exception_Init(row_locked, -54); -- ORA-00054: recurso ocupado y obtenido con NOWAIT especificado o timeout vencido
Begin
For cc In (Select codbanco From sfcp005t Where codbanco = pevc_codbanco For Update Nowait) Loop
Exit;
End Loop;
Exception
When row_locked Then
raise_application_error(-20001, 'this row is locked...', False);
-- Raise Application with True show the ORA-00054
-- Raise Application with False hide the ORA-00054
End do_something;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment