Invantive-dokumentaatioosa Invantive Cloudia
Invantive-tukifoorumitKirjaudu sisään / Rekisteröidy

SQLCODE

Syntaksi

%%{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))

Tarkoitus

The SQLCODE SQL function gets the error code of the last SQL error that occurred during execution. Funktiota voi käyttää ilman sulkuja.

Katso myös SQLERRM ja SQLROWCOUNT.

Returns: the error code of the last error as varchar2. Returns null when no error occurred.

Esimerkkejä

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;