question

OraLearner avatar image
OraLearner asked

What is Pragma Init Exception in oracle?

What is Pragma Init Exception in oracle? Difference between user defined exception and init pragma exception ? Thank you.

oracleplsqlexception
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KillerDBA avatar image KillerDBA commented ·
Is there some specific reason you haven't approved the answer? Do you have some reason to believe the answer isn't reasonably correct? The answer mentions an Oracle feature that is worded very slightly differently than your question... is that significant? Were you really asking a question about a different concept? If so, you should probably post a comment to that effect.
0 Likes 0 ·

1 Answer

·
KillerDBA avatar image
KillerDBA answered

It's actually PRAGMA EXCEPTION_INIT (, ) and it's a pre-compiler directive on how to set up for error handling.

From "Oracle Database 11g PL/SQL Programming" by Michael McLaughlin...

The example program ddefines an EXCEPTION variable and mapes the exception to an error number...

declare
    a varchar2 (20);
    invalid_userenv_param exception;
    pragma exception_init(invalid_userenv_param,-2003);
begin
    a := sys_context('userenv','proxy_pusher');
exception
    when invalid_userenv_param then
    	dbms_output.put_line(sqlerrm);
    end;
/
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.