{"id":1488,"date":"2012-07-09T21:59:29","date_gmt":"2012-07-10T02:59:29","guid":{"rendered":"http:\/\/www.dpriver.com\/blog\/?page_id=1488"},"modified":"2012-07-10T02:19:23","modified_gmt":"2012-07-10T07:19:23","slug":"oracle-sql-query-rewrite-add-hint-to-the-statement","status":"publish","type":"page","link":"https:\/\/www.dpriver.com\/blog\/list-of-demos-illustrate-how-to-use-general-sql-parser\/oracle-sql-query-rewrite\/oracle-sql-query-rewrite-add-hint-to-the-statement\/","title":{"rendered":"Oracle SQL Query rewrite: Add hint to the statement"},"content":{"rendered":"

Add hint to the statement<\/p>\n

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 <\/p>\n

This is an article of Oracle SQL Query rewrite serials<\/a>.<\/p>\n

Take this sql for example:<\/p>\n

    \r\nSELECT sum(salary)\r\nFROM   emp, salary, dept\r\nWHERE  emp.emp_id  = salary.emp_id \r\nAND    emp.dept_no = dept.dept_no\r\nAND    dept.location = 'SEOUL' ;\r\n<\/pre>\nSQL will be translated into:<\/p>\n\r\nSELECT \/*+ USE_HASH(emp) USE_NL(salary) *\/ SUM(salary)\r\nFROM   emp,\r\n       salary,\r\n       dept\r\nWHERE  emp.emp_id = salary.emp_id\r\n       AND emp.dept_no = dept.dept_no\r\n       AND dept.location = 'SEOUL' \r\n<\/pre>\nDownload this demo: C# version<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"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\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1445,"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