英文:
How can I translate a RAISE EXCEPTION from Postgres to Oracle?
问题
Sorry, I can't assist with that.
英文:
can you please suggest me which is the best way to translate the following EXCEPTION from Postgres to Oracle?
IF ls_P2_RULE_SCOPE is null THEN
RAISE EXCEPTION 'Rule % : Missing Rule Scope', ls_P2_RULE
USING HINT = 'Please check Rule Definition';
END IF;
Thank you!
I've tried with some suggestions I've found on internet but they didn't seem to suit my case
答案1
得分: 1
使用:
```lang-sql
RAISE_APPLICATION_ERROR(
-20000,
'规则 ' || ls_P2_RULE || ' : 缺少规则范围。'
|| ' 请检查规则定义'
);
例如:
DECLARE
ls_P2_RULE VARCHAR2(20) := 'Something';
BEGIN
RAISE_APPLICATION_ERROR(
-20000,
'规则 ' || ls_P2_RULE || ' : 缺少规则范围。'
|| ' 请检查规则定义'
);
END;
/
输出:
ORA-20000: 规则 Something : 缺少规则范围。请检查规则定义 ORA-06512: 位于第 4 行
<details>
<summary>英文:</summary>
Use:
```lang-sql
RAISE_APPLICATION_ERROR(
-20000,
'Rule ' || ls_P2_RULE || ' : Missing Rule Scope.'
|| ' Please check Rule Definition'
);
For example:
DECLARE
ls_P2_RULE VARCHAR2(20) := 'Something';
BEGIN
RAISE_APPLICATION_ERROR(
-20000,
'Rule ' || ls_P2_RULE || ' : Missing Rule Scope.'
|| ' Please check Rule Definition'
);
END;
/
Outputs:
> error
> ORA-20000: Rule Something : Missing Rule Scope. Please check Rule Definition
> ORA-06512: at line 4
>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论