Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Raise exception in the function that used in a select.
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