title: How to display SQL statement including host variable values in Oracle Pro*C?
body: <p>In Pro*C code you can get the last executed SQL statement via <a href="http://docs.oracle.com/cd/E14072_01/appdev.112/e10825/pc_09err.htm#i6810" rel="nofollow"><code>sqlgls()</code> (or even <code>SQLStmtGetText()</code>)</a>.</p>
  
  <p>This is useful for logging purposes - especially for dynamic statements.</p>
  
  <p>But the SQL statement returned by these SQLLIB functions only inlcudes bind markers (i.e. something like <code>:b1</code>, <code>:b2</code> ...). The do not include the actual values of the used host-variables.</p>
  
  <p>Thus, I have following question: How to I display the last SQL-statement including host-variable values?</p>
  
  <p>Else I have to manually print all used variables after printing the string returned by <code>sqlgls()</code>. Which is not really more convenient than printing the SQL statement without using <code>sqlgls</code> at all.</p>
  
  <p>For example instead of</p>
  
  <pre><code>INSERT INTO MYTABLE VALUES (:b1, :b2, :b3);
  </code></pre>
  
  <p>I want to print:</p>
  
  <pre><code>INSERT INTO MYTABLE VALUES ("hello", "world", 12);
  </code></pre>
  
  <p>(besides logging, to make it easier to copy'n'paste it into an SQL-shell - i.e. for testing)</p>