Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Excellent Tip to avoid recursive work
About one question someone did me, for the previous example, when you only
need to get data once per session (becuase it is not going to change in the
session) and then use several times.
Is better to create a pa ckage and in the begin..end area of the package
you can put code that
will be executed only the first time you use the package, so there will be
not be consistent gets after that.
And you don't need to recreate your querys.
The sub query was useful to use when you have to get a data that will not
change in the query, but can change in the session and is used several times
in the query.
:)
create or replace
package daz.PCK_ME is
cEmpresa VARCHAR2(3);
nGestion NUMBER(4);
end;
/
create or replace
package body daz.PCK_ME is
begin
SELECT USR_EMPRESA,USR_GESTION INTO cEmpresa,nGestion
FROM UTL_USUARIO_SIS WHERE USR_NOMSIS = USER;
end;
/
CREATE OR REPLACE
FUNCTION daz.db_UTL_ME
RETURN VARCHAR2 IS
BEGIN
RETURN DAZ.PCK_ME.cEmpresa;
END;
/
CREATE OR REPLACE
FUNCTION daz.db_utl_me_gestion
RETURN NUMBER IS
BEGIN
RETURN DAZ.PCK_ME.nGestion ;
END;
/
Juan Carlos Reyes Pacheco
OCP
Database 9.2 Standard Edition
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Thu May 06 2004 - 13:56:57 CDT
![]() |
![]() |