How does Oracle handle repeated calculations? Is it evaluated once or is it evaluated each time it is encountered?
For instance in a case statement creating buckets for counting
CASE
WHEN A Date - Discharge Date < 31 THEN '000-030'
WHEN A Date - Discharge Date < 61 THEN '031-060'
WHEN A Date - Discharge Date < 91 THEN '061-090'
ELSE '091+'
END
Can this be rewritten in the other CASE form as
CASE A Date - Discharge Date
WHEN ???? THEN '000-030'
...
ELSE '091+'
END
I realize the SQL is not in Oracle SQL format. My question is on the substance as the tool I use will put it in Oracle format when the query is built.
I know some databases will calculate the A Date - Discharge Date once and others would in this case calculate it 3 times. This is just an example. My real statement I am working with has the calculation repeated 14 times thus my concern for speed
mlmcc
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.