---
title: "RAISE_ERROR"
description: "RAISE_ERROR SQL \uD568\uC218\uB294 \uC9C0\uC815\uB41C \uC624\uB958 \uCF54\uB4DC\uC640 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB85C SQL\uC5D0\uC11C \uC624\uB958\uB97C \uBC1C\uC0DD\uC2DC\uD0B5\uB2C8\uB2E4."
language: ko
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/ko/docs/invantive-universalsql/grammar/sql-functions/raise-error
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/raise-error
updated: 2026-12-04T14:13:45Z
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)) --> RAISE_ERROR[RAISE_ERROR]
    RAISE_ERROR --> End((END))
```

## 목적
`RAISE_ERROR` SQL 함수는 지정된 오류 코드와 오류 메시지로 SQL에서 오류를 발생시킵니다. 오류는 표현식이 실제로 평가될 때에만 발생하므로, 쿼리 결과에 따라 오류를 발생시킬 수 있습니다.

매개변수:
- 오류 코드(`varchar2`): 오류 코드입니다. `null`이(가) null이거나 비어 있으면 기본 오류 코드가 사용됩니다.
- 오류 메시지(`varchar2`): 오류 메시지입니다. `null`이(가) null이거나 비어 있으면 기본 오류 메시지가 사용됩니다.
- 요청 종류(선택 사항, `varchar2`): 요청의 종류입니다.
- 자연 키(선택 사항, `varchar2`): 관련 데이터의 자연 키입니다.

반환값: 이 함수는 값을 반환하지 않으며, 평가 시 오류를 발생시킵니다.

## 예시
다음 예제는 사용자 정의 오류 코드와 메시지로 오류를 발생시킵니다:
```sql
select raise_error('itgenboe123', 'The value is not allowed')

itgenboe123: The value is not allowed
```
다음 예제는 금액이 음수인 행에 대해서만 오류를 발생시킵니다:
```sql
select case
       when amount < 0
       then raise_error('itgenboe124', 'A negative amount is not allowed')
       else amount
       end
from   ( select 1 amount union all select -1 )
```

