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: Excellent Tip to avoid recursive work

Re: Excellent Tip to avoid recursive work

From: Juan Cachito Reyes Pacheco <jreyes_at_dazasoftware.com>
Date: Thu, 6 May 2004 14:54:21 -0400
Message-ID: <01f801c4339b$90185e00$2501a8c0@dazasoftware.com>


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_at_freelists.org put 'unsubscribe' in the subject line.
--
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

Original text of this message

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