How to specify a hint

A hint is provided to the cost-based optimizer in the form of a comment within the SQL statement. Specifically, after you begin the comment (with either the “- -” or “/* " comment syntax), start the hint with a “+ " followed by the specific hint. If the hint is not properly formatted, it will not be honored.

Warning

The cost-based optimizer is unable to distinguish between an incorrectly specified hint and a comment. If you do not use correct syntax to provide the hint, not only will the hint not be taken, no error message will be generated.

Following are two ways you can specify the same hint:

SELECT /*+ RULE */  emp, ename, job, dname
FROM emp,dept
WHERE emp.deptno = dept.deptno;

SELECT --+ RULE
emp, ename, job, dname
FROM emp,dept
WHERE emp.deptno = dept.deptno;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset