Home » SQL & PL/SQL » SQL & PL/SQL » Error handling and package dependencies
Error handling and package dependencies [message #37594] Fri, 15 February 2002 01:07 Go to next message
marco
Messages: 46
Registered: March 2001
Member
hi,
I have a Package1 that uses a function that performs some checks. If something goes wrong I call package2.procedure_error to handle and report errors. To test the call to the procedure_error I have inserted a line of code that raise a TOO_MANY_ROWS exception. Now the test has been successful but I get ORA-06503(Function returned without value) unhandled. Why hasn't it been captured by my error_routine?
here's the code:

-- inside package1

FUNCTION Check RETURN BOOLEAN IS;

SELECT course INTO v_count FROM CLASSES <---- raise for testing purpose too_many_rows
WHERE dep = dep;
...
RETURN v_Returnvalue;
EXCEPTION
WHEN OTHERS THEN
Package2.Procedure_error('package1.Check: ',SQLERRM(SQLCODE));
END Check;.
---------------------------------------------------
When I recompile the specification and body of my Package2.Procedure_error I notice that the status of package1 body gets invalid, even thougn I haven't changed the forward declaration of package2.Procedure_error . Why is this?
I know there is a parameter called REMOTE_DEPENDENCIES_MODE but I work on the server side only so is there a parameter called DEPENDENCIES_MODE? And is there a command to show dependences parameters default values from sql+?

Thanks Marco
Re: Error handling and package dependencies [message #37610 is a reply to message #37594] Fri, 15 February 2002 09:26 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
If you error logging procedure is not calling raise_application_error, then control is passed back to your function right after the call to the procedure. Since there is no return statement after the procedure call, the 'returned without value' error is generated.

So, if you want a 'silent' error (meaning it gets logged but operation continues), then just add a return value (true or false as appropriate) after the proc call.

And, yes, if you compile the spec of a package, any dependencies on that package will go invalid. They should recompile automatically though the next time they are called (assuming no errors).
Re: Error handling and package dependencies [message #38511 is a reply to message #37594] Wed, 24 April 2002 02:01 Go to previous message
manohar
Messages: 15
Registered: October 2001
Junior Member
FUNCTION Check RETURN BOOLEAN IS;

SELECT course INTO v_count FROM CLASSES <---- raise for testing purpose too_many_rows
WHERE dep = dep;
...
RETURN v_Returnvalue;
EXCEPTION
WHEN OTHERS THEN
Package2.Procedure_error('package1.Check: ',SQLERRM(SQLCODE));
END Check;.

This happens because
when it hits the exception
it will execute package2
and since function has to return a value
it finds nothing to return
and raises this exception
in your exception after executing package2
put return false;
Previous Topic: Re: How to load ....
Next Topic: SELECT STATEMENT
Goto Forum:
  


Current Time: Fri Apr 26 23:27:15 CDT 2024