rspec/rules/S2450/plsql/rule.adoc

39 lines
833 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
``++RAISE_APPLICATION_ERROR++`` may only be called with an error code from ``++-20,000++`` to ``++-20,999++``, which is the range reserved for application errors. When called with another value, Oracle raises the exception: ``++ORA-21000: error number argument to raise_application_error of 0 is out of range.++``
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,sql]
2021-04-28 16:49:39 +02:00
----
BEGIN
RAISE_APPLICATION_ERROR(0, 'This is an application error'); -- Non-Compliant - raises ORA-21000
END;
/
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,sql]
2021-04-28 16:49:39 +02:00
----
BEGIN
RAISE_APPLICATION_ERROR(-20000, 'This is an application error'); -- Compliant
END;
/
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
"nnn" is an invalid error code.
endif::env-github,rspecator-view[]