Invantive 문서Invantive Cloud의 일부
Invantive 지원 포럼로그인 / 회원가입

SQLCODE

구문

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

목적

The SQLCODE SQL function gets the error code of the last SQL error that occurred during execution. 이 함수는 괄호 없이 사용할 수 있습니다.

SQLERRM 및 SQLROWCOUNT도 참조하십시오.

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

예시

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;