Re: tuning query with concat string.

  • From: "Juan Carlos Reyes Pacheco" <juancarlosreyesp@xxxxxxxxx>
  • To: sjaffarhussain@xxxxxxxxx
  • Date: Tue, 21 Mar 2006 12:11:18 -0400

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
--
//www.freelists.org/webpage/oracle-l


Other related posts: