Oracle - 获取替换变量的实际查询

时间:2015-03-02 23:40:08

标签: sql oracle oracle11g bi-publisher

我知道我可以SELECT sql_text FROM v$sql来获取查询,但这不是正在运行的实际查询,因为它仍然包含变量。

例如,它返回

SELECT H.TYPE, H.STATUS, L.FLAG_2, L.QTY_ORDERED
FROM ODH H, ODL L
WHERE H.ORDER_NUMBER = L.ORDER_NUMBER
AND L.ORDER_NUMBER = :B2
AND L.ORDER_LINE = :B1
AND ROWNUM = 1

有没有办法查看正在运行的实际查询,以便我可以确定传递给查询的值是什么?

1 个答案:

答案 0 :(得分:1)

SELECT sql_id, value_string
FROM v$sql_bind_capture
WHERE name = ':B2'
OR name = ':B1'

SELECT name, value_string
FROM v$sql_bind_capture
WHERE sql_id = your_query_id