vikky
vikky

Reputation: 171

RAISE_APPLICATION_ERROR In Oracle

I have an error being raised in SQL Server using RAISERROR as below:

    RAISERROR (N'The following required values are either missing or not valid from the dbo.tblTemplates_Load_OtherObjects_Raw table:%s',
           16, -- Severity,
           1, -- State,
           @MissingData)

Where @MissingData is an NVarchar variable which is being created at runtime.

How to achieve the same in Oracle?

I know that there is a RAISE_APPLICATION_ERROR in Oracle ,but don't know how to pass the values dynamically.

Upvotes: 0

Views: 1532

Answers (1)

Littlefoot
Littlefoot

Reputation: 143103

Like this - concatenation:

raise_application_error(-20001, 'Values missing: ' || l_value1 ||', '|| l_value2);

Error number you can use is between -20000 and -20999. The second parameter is the message - either just some text, or variable value, or - as I've said - text concatenated with some other values.

In your case, the might be

raise_application_error(-20001, 'Values missing: ' || missingData);

Upvotes: 2

Related Questions