How to Get Bind Variable Value in Oracle Database

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
To retrieve the value of a bind variable in Oracle, you can use the V$SQL_BIND_CAPTURE view or the DBMS_APPLICATION_INFO package, depending on your use case. Here's how you can do it: Using V$SQL_BIND_CAPTURE View: The V$SQL_BIND_CAPTURE view provides information about captured bind values for SQL statements in the library cache. You can query this view to retrieve the values of bind variables for specific SQL statements. 
Here's an example:
SELECT *
FROM V$SQL_BIND_CAPTURE
WHERE SQL_ID = 'your_sql_id';
advertisements
 

SELECT
sql_id,
b. LAST_CAPTURED,
t.sql_text sql_text,
b.HASH_VALUE,
b.name bind_name,
b.value_string bind_value
FROM
gv$sql t
JOIN
gv$sql_bind_capture b using (sql_id)
WHERE
b.value_string is not null
AND
sql_id='&sqlid'
/

_____________________________________________________________________________________________________________________

Website Stats

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-23 All Rights Reserved | Site Map | Contact | Disclaimer