如何将RAISE EXCEPTION从Postgres转换为Oracle?

b1payxdu  于 2023-06-22  发布在  Oracle
关注(0)|答案(1)|浏览(69)

你能建议我哪一种是最好的方法来翻译下面的例外从Postgres到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;

谢谢你!
我尝试了一些建议,我发现在互联网上,但他们似乎并不适合我的情况

dkqlctbz

dkqlctbz1#

用途:

RAISE_APPLICATION_ERROR(
  -20000,
  'Rule ' || ls_P2_RULE || ' : Missing Rule Scope.'
  || ' Please check Rule Definition'
);

例如:

DECLARE
  ls_P2_RULE VARCHAR2(20) := 'Something';
BEGIN
  RAISE_APPLICATION_ERROR(
    -20000,
    'Rule ' || ls_P2_RULE || ' : Missing Rule Scope.'
    || ' Please check Rule Definition'
  );
END;
/

输出:

ORA-20000: Rule Something : Missing Rule Scope. Please check Rule Definition
ORA-06512: at line 4

fiddle

相关问题