Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Decode calculates before it evaluates

Decode calculates before it evaluates

Decode calculates before it evaluates

Oracle say that decode performs the calculations before it determines which value it needs to calculate eg:

select (client_type, 'BAD', get.nasty_interest_rate,
                     'GOOD', get.nice_interest_rate)
into interest_to_pay
from dual;

Meaning the package function get.nasty_interest_rate and get.nice_interest_rate is calculated before it determines what the client_type contains.  If you audit calculation accesses in get then you get lots of false hits and big overheads.  This example is not the actual code but just illustrates the problem.  I know that you would think you could use "if then else" but believe me in the case that I want to use this in, that would not be possible.  My current work around is to use dynamic sql which does not impress me much.  Anyone got any views on this problem.  Is Oracle right, and why should this daft processing be like this?

RE: Decode calculates before it evaluates

    I'm not sure that both get.interest_rate functions are evaluated.
Oracle does check that the functions exist and that you are allowed
to execute them.  But in some very limited testing that I did, only
the 'selected' function was actually calculated.  Maybe someone out there
has experience with this.

Jim Carlson

oracle, vb, some javascript

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close