pro*c
is used to develop a business application that handles Oracle databases, but if you write the SQL portion embedded with comments (bound by /*
to */
) in the pc file and precompile it.
For example, write the following SQL statement in a pc file and
EXEC SQL AT:psz_dbname SELECT NAME FROM EMPLOYEE/*SQL-ID:selEmployee*/;
The precompiled and created c file will contain the following SQL:
sqlstm.stmt="SELECT NAME FROM EMPLOYEE";
Therefore, when the execution module compiled from this pc file is run and the above SQL is issued, the v$sqltext
table is registered as follows:
SQL_TEXT
- - - - - - - - - -
SELECT NAME FROM EMPLOYEE;
However, the customer would like to register as follows so that they can quickly find the desired SQL in v$sqltext
with a large amount of SQL being issued.
SQL_TEXT
- - - - - - - - - -
SELECT NAME FROM EMPLOYEE /* SQL-ID: selEmployee*/;
In this way, you can uniquely identify the SQL by searching for it in selEmployee.
Therefore, I really want to prevent SQL statements embedded with comments in the pc file from being deleted from the corresponding SQL statements in the c file created by precompilation, but I don't know how to do that.
I'm in big trouble.
If anyone knows, I would like to ask you to teach me
Thank you for your cooperation.
Why not write SQL comments in ANSI format?
The C preprocessor does not recognize this format as a comment, so we thought it would not be deleted.
※ As there is no environment, we have not been able to verify the behavior of this method.
EXEC SQL SELECT NAME FROM EMPLOYEE -- SQL-ID: selEmployee
;
© 2024 OneMinuteCode. All rights reserved.