Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Raise exception in the function that used in a select.

Raise exception in the function that used in a select.

From: Lev Yunak <L.Yunak_at_vaz.ru>
Date: 22 Nov 1999 09:03:09 GMT
Message-ID: <01bf34c8$87fbe880$101aa8c0@lev.vaz.ru>


This problem isn't funny. I really need to sovle it.

I want to raise exception in fucntion like

function test(...) return number is
begin
...

 raise_application_error(-20800, 'Error because lalala');
...

end;

AND use it in a select like

select test(...) from dual

I can't do it because oracle "doesn't garantee that test() doesn't change database".
Well. I define test() in package and use pragma  

PRAGMA RESTRICT_REFERENCES (test, WNDS);

Oracle say: "PLS-00452: Subprogram 'TEST' break its pragma"

In this case raise_application_error changes database. That's problem.
How I can raise exception with good number and good message in test() function.

I can use follow construction but I can get only error number without error message when it raised.

function test return number is
  errtest EXCEPTION;
  PRAGMA EXCEPTION_INIT(errtest, -20800); begin
...

 raise errtest;
...

end;

For example
select test from dual

printed:
ORA-20800: ORA-06512: in "test", line ....

I need in error message... Received on Mon Nov 22 1999 - 03:03:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US