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!

Greater than is giving me equal to's

761363Mar 26 2010 — edited Mar 26 2010
So I'm writing a procedure in PL/SQL that has the logic below:

SELECT
	... 
FROM 
	...
WHERE
    CASE
        WHEN travel_time IS NULL THEN NULL
        WHEN travel_time = 0       THEN NULL
        ELSE miles/(travel_time/60)
    END >
    CASE
        WHEN (SUBSTR(id, 2, 3) BETWEEN '099' AND '200')
            THEN 60
        ELSE 45
    END;
In the result set, I'm getting records where the result of the first and second case statement are both 60.

So basically, if the result of the first case statement is GREATER THAN the result of the second case statement, the record is supposed to show up, but I'm getting records that are GREATER THAN OR EQUAL TO. I'm sure I could just change the second case statement to give 61 rather than 60, and I'm sure it would work. But shouldn't this logic work without having to do that?

Thanks!

Edited by: jjmiller on Mar 26, 2010 7:24 AM
This post has been answered by Frank Kulash on Mar 26 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 23 2010
Added on Mar 26 2010
4 comments
938 views