In Pro * C code, you can get the last SQL statement executed through (or even ) . sqlgls()SQLStmtGetText()
This is useful for logging, especially for dynamic statements.
But the SQL statement returned by these SQLLIB functions includes only anchor labels (e.g. :b1, :b2...). Do not include the actual values of the host variables used.
So I have the following question: How to display the last SQL statement, including the values of the host variable?
Otherwise, I need to manually print all the variables used after printing the string returned sqlgls(). This is not very convenient than printing an SQL statement without using it sqlglsat all.
For example, instead of
INSERT INTO MYTABLE VALUES (:b1, :b2, :b3);
I want to print:
INSERT INTO MYTABLE VALUES ("hello", "world", 12);
(in addition to logging, to simplify copying, "insert it into the SQL shell, i.e. for testing)
source
share