Print Thread
DBMS_XPLAN.DISPLAY_CURSOR
#53680 07/06/16 01:09 PM
Joined: Jul 2016
Posts: 1
R
Member
OP Offline
Member
R
Joined: Jul 2016
Posts: 1
Team,

we are using Oracle PL/SQL Developer for Database development, but getting this error while invoking dbms_xplan.display_cursor.

<error>
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
SQL_ID 9m7787camwh4m, child number 0
begin :id := sys.dbms_transaction.local_transaction_id; end;
NOTE: cannot fetch plan for SQL_ID: 9m7787camwh4m, CHILD_NUMBER: 0
Please verify value of SQL_ID and CHILD_NUMBER;
It could also be that the plan is no longer in cursor cache (check v$sql_p
</error>

Could you help us to resolve this? more details available at the below link.

https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9530273800346286574

Re: DBMS_XPLAN.DISPLAY_CURSOR
Rajeshwaran, J #53681 07/06/16 02:30 PM
Joined: Sep 2003
Posts: 387
London, UK
Member
Offline
Member
Joined: Sep 2003
Posts: 387
London, UK
Some details would help.

What sequence of commands are you executing? Which window type are you using?

In general, interactive clients like SQL*Plus and PL/SQL Developer tend to run various steps automatically after returning from a database call. In this case it appears PL/SQL Developer is calling dbms_transaction.local_transaction_id to determine whether to light up the Commit/Rollback toolbar buttons. I'm guessing what you'd like to see is a setting to disable this at window level (perhaps a SET command for Command windows), but I am pretty sure there is no such option currently.

What I generally do is put both the query and the call to dbms_xplan inside a single PL/SQL block.

Code
begin
    execute immediate 'alter session set statistics_level = ALL';

    for test in (
        -- Your test query here:
        select * from some_table t
        where  t.some_col = 123
    )
    loop
        null;
    end loop;

    for x in (
        select p.plan_table_output
        from   table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST +OUTLINE +NOTE')) p
    )
    loop
        dbms_output.put_line(x.plan_table_output);
    end loop;

    rollback;
end;

One advantage of this is that you can use native PL/SQL variables such as dates, which aren't supported by SQL*Plus.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.026s Queries: 15 (0.006s) Memory: 2.5007 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-04-26 00:36:06 UTC
Valid HTML 5 and Valid CSS