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

  • From: JApplewhite@xxxxxxxxxxxxx
  • To: Brandon.Allen@xxxxxxxxxxx
  • Date: Thu, 3 May 2007 20:59:21 -0500

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
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)




"Allen, Brandon" <Brandon.Allen@xxxxxxxxxxx> 
Sent by: oracle-l-bounce@xxxxxxxxxxxxx
05/03/2007 07:25 PM
Please respond to
Brandon.Allen@xxxxxxxxxxx


To
<oracle-l@xxxxxxxxxxxxx>
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


Other related posts: