Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Can you execute a function in an Oracle comment/hint?
This isn't exactly what I had in mind, and I think it will only work in
SQL*Plus, but it's getting close:
SQL> alter session set nls_date_format = 'DD-MON-YY hh24:mi:ss';
Session altered.
SQL> select /*+ &_DATE */ 1 from dual;
old 1: select /*+ &_DATE */ 1 from dual
new 1: select /*+ 04-MAY-07 13:20:25 */ 1 from dual
1
1
SQL> select hash_value, sql_text from v$sql where sql_text like '%1 from dual';
HASH_VALUE SQL_TEXT
SQL> select /*+ &_DATE */ 1 from dual;
old 1: select /*+ &_DATE */ 1 from dual
new 1: select /*+ 04-MAY-07 13:24:25 */ 1 from dual
1
1
SQL> select hash_value, sql_text from v$sql where sql_text like '%1 from dual';
HASH_VALUE SQL_TEXT
This could also be done with _USER, or any of the other 8 predefined variables, as described below, but _DATE is the only one that can give a unique hash_value every time:
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12 017.htm#sthref2145
Privileged/Confidential Information may be contained in this message or attachments hereto. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of this company shall be understood as neither given nor endorsed by it.
-- http://www.freelists.org/webpage/oracle-lReceived on Fri May 04 2007 - 15:25:40 CDT
![]() |
![]() |