如何在从 v$sql 收到的 Oracle 查询中查找参数?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14217461/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:21:58  来源:igfitidea点击:

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

oracleparametersprepared-statement

提问by user710818

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、2 和 3?

回答by a_horse_with_no_name

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;