Skip to Main Content

SQL & PL/SQL

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!

Anything similar to DECODE function in PL/SQL?

anasaziiSep 23 2016 — edited Sep 24 2016

This is more out of curiosity than anything...I know Decode is only available in SQL. 

I know in PL/SQL I can type out something like this...the function is irrelevant, just an example

if (P_COMMIT = 'Y') then

   v_commit := 'Validate and Load';

else

   v_commit :=  'Validate Only';

end if;

myFunction('P_COMMIT', v_commit);

Just because I like to keep things a simple and short as possible, it would sure be nice to be able to just write this...just wondering if there's any new PL/SQL functions out there I've missed that would help simplify things?

myFunction('P_COMMIT', decode(P_COMMIT, 'Y', 'Validate and Load', 'Validate Only'));

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2016
Added on Sep 23 2016
7 comments
3,457 views