tora icon indicating copy to clipboard operation
tora copied to clipboard

Problem (solved) with toSession:OpenCursor query

Open ghpille opened this issue 7 years ago • 0 comments

The order of the selected columns is important, and currently (version 3.2) wrong. As a consequence, the right hand side of the Open Cursors (sql text, explain plan, ...) remains empty or causes errors. Easily solved by using the following query:


 select SQL_Text SQL                        
       , p.child_number as chld
       , c.SQL_ID as sqlid
       , CURSOR_TYPE                        
       , LAST_SQL_ACTIVE_TIME               
       , SQL_EXEC_ID                        
 from v$open_cursor c 
 join v$sql_plan p
   on c.ADDRESS = p.ADDRESS
   and c.HASH_VALUE = p.HASH_VALUE
   and c.sql_id = p.sql_id
   and p.id = 0
 where sid = :f1<char[101]>

If you prefer these columns remain hidden, change the aliases. as chld => as " child_number" as sqlid => as " sql_id" (an alias starting with a space hides the column)

ghpille avatar Apr 13 '18 10:04 ghpille