获取绑定变量方法

来源:互联网 发布:淘宝美女老板亲自示范 编辑:程序博客网 时间:2024/06/03 21:32

1.     SQL

SELECT

   a.sql_text,
   b.name,
   b.position,
   b.datatype_string,
   b.value_string
FROM
  v$sql_bind_capture b,
  v$sqlarea          a
WHERE
   b.sql_id = 'dpf3w96us2797'
AND

   b.sql_id = a.sql_id;


2.

You can run a 10046 level 4 or 12 trace to debug code with bind variables and see the bind variable values as it steps through the code:

EXECUTE SYS.dbms_system.set_ev (42, 45529,10046,12,'');

然后在跟踪文件里可以看到绑定变量的值;

(1 = no binds,no waits, 4 = binds, no waits, 8 = no binds, waits, 12 = binds, waits)


3.注意事项

This view is populated only when you set STATISTICS_LEVEL parameter to ALL/TYPICAL . Bind capturing is disabled when the STATISTICS_LEVEL initialization parameter is set to BASIC.


原创粉丝点击