SQLCODE
Syntaxe
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> SQLCODE[SQLCODE]:::quoted
SQLCODE --> End((END))
Účel
The SQLCODE SQL function gets the error code of the last SQL error that occurred during execution. Funkci lze použít bez závorek.
Viz také SQLERRM a SQLROWCOUNT.
Returns: the error code of the last error as varchar2. Returns null when no error occurred.
Příklady
The following example retrieves the error code of the last error; the output is empty since no error occurred:
select sqlcode
-------------------
The following example first raises a division-by-zero error and then retrieves the error code of the last error:
select 1 / 0
itgenttn082: Division of 1 by zero is impossible.
select sqlcode
-------------------
itgenttn082
The following example catches a division-by-zero error; within the exception handler SQLCODE returns the error code itgenttn082:
declare
l_dummy pls_integer;
begin
select 1/0
into l_dummy
;
exception
when others
then
dbms_output.put_line(sqlcode);
end;