Oracle query to run sql and bind variable values

If I run SQL in Figure 1 below, it may return something like this:

Select fname, lname from name_tbl where nam_key = :key 

Without using any fancy DBA trace utility, how can I query the Oracle system table to find the value of the binding variable ": key"?

Figure 1. - List the current current sql statement.

 select sid, username, sql_text from v$session, v$sqltext where sql_address = address and sql_hash_value = hash_value order by sid, piece; 
+6
oracle bind trace
source share
1 answer
 select name, value_string from v$sql_bind_capture where sql_id = your_query_id 

Upd. or, of course:

 select sql_id, value_string from v$sql_bind_capture where name = ':key' 
+6
source share

All Articles