How to find parameters in Oracle query received from v$sql?

假装没事ソ 提交于 2021-02-06 15:22:55

问题


I use query:

 select LAST_LOAD_TIME, ELAPSED_TIME, MODULE, SQL_TEXT elasped from v$sql
 WHERE MODULE='JDBC Thin Client'
 ORDER BY LAST_LOAD_TIME DESC

elasped:

 delete from tableA where fk in (select pk from tableB where tableB.fk=:1
 and tableB.date between :2 and :3)

Is it possible find these parameters 1, 2 and 3?


回答1:


Something like this:

select s.sql_id, 
       bc.position, 
       bc.value_string, 
       s.last_load_time, 
       bc.last_captured
from v$sql s
  left join v$sql_bind_capture bc 
         on bc.sql_id = s.sql_id 
        and bc.child_number = s.child_number
where s.sql_text like 'delete from tableA where fk%' -- or any other method to identify the SQL statement
order by s.sql_id, bc.position;


来源:https://stackoverflow.com/questions/14217461/how-to-find-parameters-in-oracle-query-received-from-vsql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!