Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Can you execute a function in an Oracle comment/hint?

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

From: <JApplewhite_at_austinisd.org>
Date: Thu, 3 May 2007 21:11:36 -0500
Message-ID: <OFE7ECB46F.03F01FE2-ON862572D1.000B7ACF-862572D1.000C0F16@austinisd.org>


Couldn't leave it alone. This works:
Begin
Execute Immediate 'Select /* ' || sys_context('USERENV','SESSION_USER')|| ' */ SysDate From Dual ' ;
End ;
/

Jack C. Applewhite - Database Administrator Austin (Texas) Independent School District 512.414.9715 (wk) / 512.935.5929 (pager)

 I'll just sit back in the shade while everyone gets laid  that's what I call 'intelligent design'. -- God ("Origin of Species": Chris Smither)

Jack Applewhite/CAC/AISD
05/03/2007 08:59 PM

To
Brandon.Allen_at_OneNeck.com
cc
oracle-l_at_freelists.org, oracle-l-bounce_at_freelists.org Subject
Re: Can you execute a function in an Oracle comment/hint?

How about
Execute Immediate 'Select ''/* ' || sys_context('USERENV','SESSION_USER') || ' */' , SysDate From Dual ;

I may not have the single quotes just right, but I'm headed for the shower, so you can do the testing. Heck, this may not even be close! ...but it looks good to me.

Hope it helps.

Jack C. Applewhite - Database Administrator

"Allen, Brandon" <Brandon.Allen_at_OneNeck.com> Sent by: oracle-l-bounce_at_freelists.org
05/03/2007 07:25 PM
Please respond to
Brandon.Allen_at_OneNeck.com

To
<oracle-l_at_freelists.org>
cc

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

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?

Thanks,
Brandon

--
http://www.freelists.org/webpage/oracle-l
Received on Thu May 03 2007 - 21:11:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US