Oracle SQL Query rewrite: Add hint to the statement

Add hint to the statement

If we want to add hint for some table in the statement, We provides table name and hint string to GSP through arguments. If a table apprears more than twice in the statement then GSP should make more than two alternative SQLs

This is an article of Oracle SQL Query rewrite serials.

Take this sql for example:

SELECT sum(salary)
FROM   emp, salary, dept
WHERE  emp.emp_id  = salary.emp_id 
AND    emp.dept_no = dept.dept_no
AND    dept.location = 'SEOUL' ;

SQL will be translated into:

SELECT /*+ USE_HASH(emp) USE_NL(salary) */ SUM(salary)
FROM   emp,
       salary,
       dept
WHERE  emp.emp_id = salary.emp_id
       AND emp.dept_no = dept.dept_no
       AND dept.location = 'SEOUL' 

Download this demo: C# version