---
title: "SQLERRM"
description: "SQLERRM SQL \uD568\uC218\uB294 \uC2E4\uD589 \uC911 \uBC1C\uC0DD\uD55C \uB9C8\uC9C0\uB9C9 SQL \uC624\uB958\uC758 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4."
language: ko
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/ko/docs/invantive-universalsql/grammar/sql-functions/sqlerrm
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/sqlerrm
updated: 2026-12-04T14:28:21Z
license: https://documentation.invantive.eu/ko/
---

## 구문
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> SQLERRM[SQLERRM]:::quoted
    SQLERRM --> End((END))
```

## 목적
`SQLERRM` SQL 함수는 실행 중 발생한 마지막 SQL 오류의 오류 메시지를 가져옵니다. 이 함수는 괄호 없이 사용할 수 있습니다.

[[SQLCODE]] 및 [[SQLROWCOUNT]]도 참조하십시오.

반환값: 마지막 오류의 오류 메시지를 `varchar2` 형식으로 반환합니다. 오류가 발생하지 않은 경우 `null`을(를) 반환합니다.

## 예시
다음 예제는 마지막 오류의 오류 메시지를 검색합니다. 오류가 발생하지 않았으므로 출력은 비어 있습니다:
```sql
select sqlerrm

-------------------

```
다음 예제는 먼저 0으로 나누기 오류를 발생시킨 다음 마지막 오류의 오류 메시지를 검색합니다:
```sql
select 1 / 0

itgenttn082: Division of 1 by zero is impossible.
```
```sql
select sqlerrm

--------------------------------------------------
itgenttn082: Division of 1 by zero is impossible.
```
다음 예제는 0으로 나누기 오류를 포착하고, `SQLERRM`이(가) 제공하는 오류 메시지로 새로운 애플리케이션 오류를 발생시킵니다:
```sql
declare
  x pls_integer;
begin
  x := 1 / 0;
exception
  when others
  then
    raise_application_error('sample', sqlerrm);
end;

sample: itgenttn082: Division of 1 by zero is impossible.
```

