Re: coding PL/SQL program more easly and quickly ?

From: Scott Galliand <galliand_at_email.com>
Date: 2000/08/05
Message-ID: <398C706B.18B29821_at_email.com>#1/1


Chris wrote:
>
> Hi, all
>
> Is there have any way could convert Code1 to Code2 :
>
> -- Code1, use package name per member.
> PKGCommon.DataMember1;
> PKGCommon.DataMember2;
> PKGCommon.Function1;
> PKGCommon.Function2;
> PKGCommon.Function3;
>
> -- Code2, use package name once only.
> with PKGCommon do
> begin
> DataMember1;
> DataMember2;
> Function1;
> Function2;
> Function3;
> end;
>
> Thanks
>
> Chris

If procedure/function/cursor/variable (from here I'll refer to the last mouthful as a PL/SQL object for simplicity's sake) local to the package is using another PL/SQL object from the same package then you shouldn't have to qualify it with the package's name. Oracle sees them as all part of the same package if it is within the package header/specification.

If you are calling the PL/SQL object in the package from another PL/SQL object not local to the package then you have to qualify it with the package's name to use it.

Example:

I write Procedure1, and I want to use DataMember1 and Function1 one from Code2. But there is also a standalone Function1 in memory as well which I also want to use. So to write Procedure1:

CREATE OR REPLACE procedure1 (/* IN/OUT/IN-OUT parameters here */) IS --declare any needed variables here
BEGIN

  • Assign results of Function1 to DataMember1 from Code2 Code2.DataMember1 := Function1; DBMS_OUTPUT.PUT_LINE(Code2.DataMember1);
  • Assign results of Code2.Function1 to DataMember1 from Code2 Code2.DataMember1 := Code2.Function1; DBMS_OUTPUT.PUT_LINE(Code2.DataMember1); END procedure1;

Hope this helps



Scott M. Galliand
Oracle DBA, DoD Information Technology Center New Orleans LA
galliand_at_email.com Received on Sat Aug 05 2000 - 00:00:00 CEST

Original text of this message