dukeslater
Technical User
Can someone please explain why the first query runs in a few seconds while the second query takes forever to run?
1. select todatefunction(numericfield), otherfields
from table
where numericfield = 1050424
2. select todatefunction(numericfield), otherfields
from table
where numericfield = tonumberfunction(sysdate)
The database stores dates as numbers, so I use two functions to convert those numbers to true date fields or to convert a date to their number format.
My understanding has always been that since we're comparing the field value to a constant there should be no difference in the performance between the two queries. Clearly I'm wrong, but I don't know why (or how to write this to process quickly).
Thanks as always for your help.
1. select todatefunction(numericfield), otherfields
from table
where numericfield = 1050424
2. select todatefunction(numericfield), otherfields
from table
where numericfield = tonumberfunction(sysdate)
The database stores dates as numbers, so I use two functions to convert those numbers to true date fields or to convert a date to their number format.
My understanding has always been that since we're comparing the field value to a constant there should be no difference in the performance between the two queries. Clearly I'm wrong, but I don't know why (or how to write this to process quickly).
Thanks as always for your help.