Oracle SQL Query rewrite: Re-write suppressed joined columns in the WHERE clause

Re-write suppressed joined columns in the WHERE clause

Columns suppressed by various functions and concatenations should be re-written in other syntax.

This is an article of Oracle SQL Query rewrite serials.

Take this sql for example:

SELECT *
FROM   fnd_concurrent_requests
WHERE  TO_CHAR(request_date, 'YYYYMMDD') = '20080520' 
AND    status_code = 'E'
AND    phase_code  = 'C' ;

SQL will be translated into:

SELECT *
FROM   fnd_concurrent_requests
WHERE  request_date >= To_date('20080520', 'YYYYMMDD')
       AND request_date < To_date('20080520', 'YYYYMMDD') + 1
       AND status_code = 'E'
       AND phase_code = 'C' 

Download this demo: C# version