Oracle SQL Query rewrite: OR clause to UNION ALL statement
OR clause to UNION ALL statement
This is an article of Oracle SQL Query rewrite serials.
Take this sql for example:
SELECT * FROM fnd_concurrent_requests WHERE ( status = 'R' OR status = 'E' ) AND request_date >= SYSDATE - 1 ;
SQL will be translated into:
SELECT * FROM fnd_concurrent_requests WHERE status = 'R' AND request_date >= SYSDATE - 1 UNION ALL SELECT * FROM fnd_concurrent_requests WHERE status = 'E' AND request_date >= SYSDATE - 1
Download this demo: C# version