Errbuf and Retcode are two OUT type mandatory parameters used in PL/SQL procedures which are called through concurrent requests.
Purpose of Errbuf and Retcode Paramters?
A Concurrent Request is submitted with the help of Concurrent Manager. At the end of execution of concurrent request, the status of the request is sent to concurrent manager through these two mandatory parameters.
Errbuf is a parameter which is used to store error message when ever a program gets into an exception block.
The content of Errbuf can be seen in the ‘Completion Text‘ field of concurrent request.
Retcode is a parameter which is used to record the status of the concurrent request. Retcode has 3 possible values
- 0 – Success
- 1 – Success but finished with Warning (yellow color)
- 2 – Error (red color)
Note: Errbuf must be as first parameter and Retcode must be as second parameter in PL/SQL procedure.
Usage of Errbuf and Retcode Paramters?
Using these two parameters in proper way will help to debug the issue easily.
We can pass values to these parameters in exception blocks like shown in the below example
EXCEPTION WHEN OTHERS THEN retcode := 2; errbuf:= 'Unexpected Error in When Others of XYZ Procedure'||SQLERRM; END; |
Note: You will get below error message if the procedure called from executable is not having Errbuf and Retcode as first two parameters:
Cause: FDPSTP failed due to ORA-06550: line 1, column 7
Please do leave a comment if you have any question on Errbuf and Retcode.