Information on Errbuf and Retcode Parameters

By | March 22, 2012

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.

WOW! Did you like this post? We'll send more interesting posts like Information on Errbuf and Retcode Parameters to you!
Enter your Email Address:
  • Londonin

    Thanks.

  • Madiresb

    EXCEPTION
    WHEN OTHERS
    THEN
    retcode := 2;
    errbuf:= ‘Unexpected Error in When Others of XYZ Procedure’||SQLERRM; ROLLBACK;
    END;is the roll back works…in this scenario…???

    •  @a0e24d2171d75ab96fc7c7230496b3a0:disqus  Yes it works!

      • Naveen

        Hi Shailender,

        Is there any specific reason to use errbuf as first parameter.

  • Prabhu

    Good Explanations