Home

RAISE_APPLICATION_ERROR should only be used with error codes from -20,000 to - 20,999

Rule description

  • RAISE_APPLICATION_ERROR should only be used with error codes from -20,000 to - 20,999

 

Non-compliant Code Example

CREATE OR REPLACE PROCEDURE CheckCustomerCreditLimit (credit_limit IN number := 0,
 output_result OUT number)
 AS
 BEGIN
 IF credit_limit < 1800 then
	raise_application_error(-10150,'Customer credit limit is too less !'); --Non compliant code (RAISE_APPLICATION_ERROR used error codes beyond defined range -20,000 to - 20,999)
 END IF;
 output_result := credit_limit;
END;

Compliant Code Example

CREATE OR REPLACE PROCEDURE CheckCustomerCreditLimit (credit_limit IN number := 0,
 output_result OUT number)
 AS
 BEGIN
 IF credit_limit < 1800 then
	raise_application_error(-20150,'Customer credit limit is too less !');
 END IF;
 output_result := credit_limit;
END;
Visual Expert 2020
 VEPLSQLRULE14