In a stored procedure (which has a date parameter named "paramDate"), I have a query like this
select id, name from customer where period_aded = to_char(paramDate,'mm/yyyy')
will Oracle convert paramDate to string for each row?
I was sure that Oracle would not, but I was told that Oracle would. In fact, I thought that if the function parameter was a constraint (not obtained or not calculated value inside the query), the result should be the same, and therefore Oracle should perform this conversion only once. Then I realized that I sometimes executed DML sentences in several functions, and perhaps this could lead to a change in the resulting value, even if it does not change for each row.
This should mean that I have to convert such values before adding them to the query.
In any case, perhaps well-known functions (built-in) are evaluated once, or even my functions will also be.
Anyway, again ...
Will oracle execute this to_char once or will Oracle do this for each row?
thank you for your responses
source share