Hi,
i am playing arround with the package DBMS_UTILITY.EXPAND_SQL_TEXT
I thought that is the sql text that the optimizer uses before it starts (doc says only for Views, but it works for other statements also) Testcase:
WITH function sql_text (text IN CLOB)
RETURN CLOB IS
ret CLOB;
BEGIN
DBMS_UTILITY.EXPAND_SQL_TEXT (
input_sql_text => text,
output_sql_text => ret);
RETURN ret;
END;
select sql_text('select d.deptno,ename from emp e right outer join dept d on e.deptno=d.deptno where ename is null') from dual;
=>SELECT "A1"."QCSJ_C000000000300001_2" "DEPTNO","A1"."ENAME_0" "ENAME" FROM (SELECT "A3"."ENAME" "ENAME_0","A3"."DEPTNO" "QCSJ_C000000000300000","A2"."DEPTNO" "QCSJ_C000000000300001_2" FROM "MUNIQ"."EMP" "A3","MUNIQ"."DEPT" "A2" WHERE "A3"."DEPTNO"="A2"."DEPTNO") "A1" WHERE "A1"."ENAME_0" IS NULL
OK test it: Result is empty, but the original Statement produce this output
DEPTNO ENAME
--------- ---------
40 null
So why is the output wrong ?
Thanks
Marco