{"id":1445,"date":"2012-07-09T05:09:30","date_gmt":"2012-07-09T10:09:30","guid":{"rendered":"http:\/\/www.dpriver.com\/blog\/?page_id=1445"},"modified":"2022-07-23T03:33:14","modified_gmt":"2022-07-23T08:33:14","slug":"oracle-sql-query-rewrite","status":"publish","type":"page","link":"https:\/\/www.dpriver.com\/blog\/list-of-demos-illustrate-how-to-use-general-sql-parser\/oracle-sql-query-rewrite\/","title":{"rendered":"Oracle SQL Query rewrite"},"content":{"rendered":"

This article includes a list of Oracle SQL rewrite rules to improve sql performance, with the help of General SQL Parser, those SQL query rewrite can be done automatically.<\/p>\n

1. (NOT) IN sub-query to (NOT) EXISTS sub-query<\/a><\/p>\n

2. (NOT) EXISTS sub-query to (NOT) IN sub-query<\/a><\/p>\n

3. Separate outer joined inline view using UNION ALL or add hint for the inline view<\/a><\/p>\n

4. IN clause to UNION ALL statement<\/a><\/p>\n

5. OR clause to UNION ALL statement<\/a><\/p>\n

6. NVL function to UNION ALL statement<\/a><\/p>\n

7. Re-write suppressed joined columns in the WHERE clause<\/a><\/p>\n

8. VIEW expansion<\/a><\/p>\n

9. NOT EXISTS to NOT IN hash anti-join<\/a><\/p>\n

10. Make columns suppressed using RTRIM function or \u2018+0\u2019<\/a><\/p>\n

11. Add hint to the statement<\/a><\/p>\n

12. Co-related sub-query to inline View<\/a><\/p>\n

Download this demo: C# version<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

This article includes a list of Oracle SQL rewrite rules to improve sql performance, with the help of General SQL Parser, those SQL query rewrite can be done automatically. 1. (NOT) IN sub-query to (NOT) EXISTS sub-query 2. (NOT) EXISTS sub-query to (NOT) IN sub-query 3. Separate outer joined inline view using UNION ALL or add hint for the inline view 4. IN clause to UNION ALL statement 5. OR clause to UNION ALL statement 6. NVL function to UNION ALL statement 7. Re-write suppressed joined columns in the WHERE clause 8. VIEW expansion 9. NOT EXISTS to NOT IN\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":235,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"gsp_feature_page_tt.php","meta":[],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"yoast_head":"\nHelp you to make better use of General SQL Parser<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n