FAQ
Hi All,

I have a package pkg1 that has a variable var 1 declared

Inside of pkg2 I want to use pkg1.var1. I always get PLS201 identifier
pkg1.var1 must be declared.
What do I need to do to correct.

Pkg1 compiles fine.

Thanks
Rick

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
INET: Rick_Cale_at_teamhealth.com

Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------

To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).

Search Discussions

  • G.Plivna_at_itsystems.lv at Jan 25, 2002 at 3:51 pm
    You have to declare this variable in package1 specification

    create or replace package pkg1 is
    v_var VARCHAR2(10) := 'Blahblah';
    end;
    /

    create or replace package pkg2 is
    procedure showvar;
    end;
    /

    create or replace package pkg2 body is
    procedure showvar
    begin
    dbms_output.put_line(pkg1.v_var);
    end;
    end;
    /

    exec pkg2.showvar
    in SQLPlus prompt should do that

    Gints Plivna
    IT Sistçmas, Meríeïa 13, LV1050 Rîga
    http://www.itsystems.lv/gints/

    Rick_Cale_at_team

    health.com To: Multiple recipients of list ORACLE-L

    Sent by: cc:

    root_at_fatcity.c Subject: How to use a package variable in
    pkg1 inside of package pkg2
    om

    2002.01.25

    16:35

    Please respond

    to ORACLE-L

    Hi All,

    I have a package pkg1 that has a variable var 1 declared

    Inside of pkg2 I want to use pkg1.var1. I always get PLS201 identifier
    pkg1.var1 must be declared.
    What do I need to do to correct.

    Pkg1 compiles fine.

    Thanks
    Rick

    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author:
    INET: Rick_Cale_at_teamhealth.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).

    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author:
    INET: G.Plivna_at_itsystems.lv

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
  • Mercadante, Thomas F at Jan 25, 2002 at 5:24 pm
    I'm not sure why you want to do this. Why not have the package that you
    call return the value back to the calling package. I would not guarantee
    that the value you expect to be stored in the variable would exist when you
    think it will be there.

    Tom Mercadante
    Oracle Certified Professional

    -----Original Message-----
    Sent: Friday, January 25, 2002 10:31 AM
    To: Multiple recipients of list ORACLE-L
    pkg2

    You have to declare this variable in package1 specification

    create or replace package pkg1 is
    end;
    /

    create or replace package pkg2 is
    procedure showvar;
    end;
    /

    create or replace package pkg2 body is
    procedure showvar
    begin
    dbms_output.put_line(pkg1.v_var);
    end;
    end;
    /

    exec pkg2.showvar
    in SQLPlus prompt should do that

    Gints Plivna
    IT Sistçmas, Meríeïa 13, LV1050 Rîga
    http://www.itsystems.lv/gints/



    Rick_Cale_at_team

    health.com To: Multiple recipients of list
    ORACLE-L
    Sent by: cc:

    root_at_fatcity.c Subject: How to use a package
    variable in pkg1 inside of package pkg2
    om

    2002.01.25

    16:35

    Please respond

    to ORACLE-L

    Hi All,

    I have a package pkg1 that has a variable var 1 declared

    Inside of pkg2 I want to use pkg1.var1. I always get PLS201 identifier
    pkg1.var1 must be declared.
    What do I need to do to correct.

    Pkg1 compiles fine.

    Thanks
    Rick

    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author:
    INET: Rick_Cale_at_teamhealth.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).

    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author:
    INET: G.Plivna_at_itsystems.lv

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Mercadante, Thomas F
    INET: Thomas.Mercadante_at_Labor.State.Ny.Us

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
  • Steve McClure at Jan 25, 2002 at 7:50 pm
    I use this techinique when I build PL/SQL applications that span packages.
    I almost always create a global package with nothing but the specification
    filled with variables. Usually these variables are established upon entry
    to the app, and are applicable for the length of the run. As for
    guaranteeing the value to be what I expect, the fact that the package
    variables are session specific takes care of that nicely.

    In regards to the original post, The specification of a package is public,
    the body is private to the package itself. If you want something to be
    available outside of a package, it needs to be declared in the
    specification.

    Steve

    -----Original Message-----
    Thomas F
    Sent: Friday, January 25, 2002 9:01 AM
    To: Multiple recipients of list ORACLE-L

    I'm not sure why you want to do this. Why not have the package that you
    call return the value back to the calling package. I would not guarantee
    that the value you expect to be stored in the variable would exist when you
    think it will be there.

    Tom Mercadante
    Oracle Certified Professional

    -----Original Message-----
    Sent: Friday, January 25, 2002 10:31 AM
    To: Multiple recipients of list ORACLE-L
    pkg2

    You have to declare this variable in package1 specification

    create or replace package pkg1 is
    end;
    /

    create or replace package pkg2 is
    procedure showvar;
    end;
    /

    create or replace package pkg2 body is
    procedure showvar
    begin
    dbms_output.put_line(pkg1.v_var);
    end;
    end;
    /

    exec pkg2.showvar
    in SQLPlus prompt should do that

    Gints Plivna
    IT Sistçmas, Meríeïa 13, LV1050 Rîga
    http://www.itsystems.lv/gints/

    Rick_Cale_at_team

    health.com To: Multiple recipients of list
    ORACLE-L
    Sent by: cc:

    root_at_fatcity.c Subject: How to use a package
    variable in pkg1 inside of package pkg2
    om

    2002.01.25

    16:35

    Please respond

    to ORACLE-L

    Hi All,

    I have a package pkg1 that has a variable var 1 declared

    Inside of pkg2 I want to use pkg1.var1. I always get PLS201 identifier
    pkg1.var1 must be declared.
    What do I need to do to correct.

    Pkg1 compiles fine.

    Thanks
    Rick

    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author:
    INET: Rick_Cale_at_teamhealth.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).

    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author:
    INET: G.Plivna_at_itsystems.lv

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Mercadante, Thomas F
    INET: Thomas.Mercadante_at_Labor.State.Ny.Us

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).

    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Steve McClure
    INET: smcclure_at_usscript.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message

    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouporacle-l @
categoriesoracle
postedJan 25, '02 at 3:05p
activeJan 25, '02 at 7:50p
posts4
users4
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase