Oracle 通过sql profile为sql语句加hint(三)

2015-07-16 12:09:11 · 作者: · 浏览: 5
('&&plan_hash_value.'))
? ? ? ? ? ? ? ? ? ? AND other_xml IS NOT NULL
? ? ? ? ? ? ? ? ? ORDER BY
? ? ? ? ? ? ? ? ? ? ? ? id)
? ? ? ? LOOP
? ? ? ? ? :other_xml := i.other_xml;
? ? ? ? ? EXIT; -- 1st
? ? ? ? END LOOP;
? ? ? END IF;
? ? EXCEPTION
? ? ? WHEN OTHERS THEN
? ? ? ? DBMS_OUTPUT.PUT_LINE('getting other_xml from awr: '||SQLERRM);
? ? ? ? :other_xml := NULL;
? ? END;
? ? /


? ? SELECT :other_xml FROM DUAL;


? ? -- validate other_xml
? ? SET TERM ON;
? ? BEGIN
? ? ? IF :other_xml IS NULL THEN
? ? ? ? RAISE_APPLICATION_ERROR(-20101, 'PLAN for SQL_ID &&sql_id. and PHV &&plan_hash_value. was not found in memory (gv$sql_plan) or AWR (dba_hist_sql_plan).');
? ? ? END IF;
? ? END;
? ? /
? ? SET TERM OFF;