How to find the bind variable values of the SQL statement using SQLID?

How to find the bind variable values of the SQL statement using SQLID?

SELECT sql_id,  b.name BIND_NAME,  b.value_string BIND_STRING   from gv$sql t
JOIN gv$sql_bind_capture b USING (sql_id) WHERE b.value_string IS NOT NULL
AND sql_id ='&SQLID';

Additional script which may be helpful at a later point in time:

To know the last executed query in the oracle and its hash value,sqlid

SELECT * FROM v$SQLTEXT_WITH_NEWLINES WHERE address =
  (SELECT prev_sql_addr FROM v$session WHERE audsid = userenv('SESSIONID'))
ORDER BY piece;

To know the SQL plan history of a sql using the sqlid:

select * from TABLE(DBMS_XPLAN.DISPLAY_AWR('&sqlid'));

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter: https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8