Can you execute a function in an Oracle comment/hint?

  • From: "Allen, Brandon" <Brandon.Allen@xxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 3 May 2007 16:36:53 -0700

I'm pretty sure I saw someone demonstrate the syntax for this before,
but I've looked everywhere and can't find it now.  What I'm trying to do
is execute a function in the in-line comment of a query, like this:

select /* sys_context('USERENV', 'SESSION_USER') */ sysdate from dual;

But, it's not working.  The above query gets executed, but the
sys_context function is not being executed, it's just being treated as a
comment.  What I want is for this query to show up as:

select /* SCOTT */ sysdate from dual

In v$sql.sql_text.

Is this possible, or am I just imagining having seen this before?


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.


Other related posts: