Re: Excellent Tip to avoid recursive work

  • From: "Juan Cachito Reyes Pacheco" <jreyes@xxxxxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 6 May 2004 14:54:21 -0400

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


----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: