Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Begin/End in PL/SQL Function Body?

Blue BirdMar 6 2019 — edited Mar 7 2019

I would like to know what approach do you use when you use PL/SQL Function Body? Do you also use just short Return SameValue; or do you always use full syntax Declare / Begin / End around code (like I see in doc or some examples)?

For example I have couple of Dynamic Actions with Action Set Value. Under Settings I selected PL/SQL Function Body. This function call my user function from Package, because I have this action on many items:

So I wrote inside:

Return MyPackage.MyFunction(:P1_VALUE_01, MyCriteria);

and everything work fine (assumed that I handle errors in my function). Can I just leave this that way OR do I have to always use Declare / Begin / End (or at least Begin / End) as good practice around my calling function:

Declare

l_Result VarChar2(5);

Begin

  l_Result := MyPackage.MyFunction(:P1_VALUE_01, MyCriteria...);

  Return l_Result;

End;

All suggestions and opinions are welcome.

Comments
Post Details
Added on Mar 6 2019
5 comments
2,052 views