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: tuning query with concat string.

Re: tuning query with concat string.

From: Juan Carlos Reyes Pacheco <juancarlosreyesp_at_gmail.com>
Date: Tue, 21 Mar 2006 12:11:18 -0400
Message-ID: <cd4305c10603210811t41619007o7e689332174c2d1f@mail.gmail.com>


Hi
select max(start_time) from fm_audit_form where ws_id = 'S'||userenv('SESSIONID')

I'm not sure if you really need to do it, and I'm telling you if oracle execute several times the userenv('SESSIONID') causing and additional work, more than once in the session.

But if the userenv('SESSIONID') is executing several times in the query and/or session. Then you cound put in a package set once (because your sessiont id will not change in your session and use that package variable.

create package x
 nSessionID number;
end;

create package body x
is
begin
  nSessionID = userenv('SESSIONID');
end;

This is the idea the first time you try to read this variable, it will execute the "query", after that, only will read the variable value

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Mar 21 2006 - 10:11:18 CST

Original text of this message

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