title: How to get the last executed SQL statement and bind variable values in oracle
body: <p>I have written the following query to get the last executed SQL statement in the oracle database for a particular session. The SQL text does not contain the actual value of the bind variables. How to get the bind variable values along with the SQL text.</p>
  
  <pre><code>SELECT * FROM v$SQLTEXT_WITH_NEWLINES WHERE address = 
    (SELECT prev_sql_addr FROM v$session WHERE audsid = userenv('SESSIONID'))
  ORDER BY piece;
  </code></pre>