Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Records : Scope and Packages

Re: Records : Scope and Packages

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 27 Jan 2000 15:58:08 -0500
Message-ID: <07c19s8cugm90tveictndtdtkqt07dd3pu@4ax.com>


A copy of this was sent to Robert Shaw <robert_shaw_at_tertio.com> (if that email address didn't require changing) On Thu, 27 Jan 2000 17:39:26 +0000, you wrote:

>
>Hi,
>
>I'm having some trouble with passing PL/SQL Records between Procedures
>in different Packages. When I try to source, I get "wrong type"
>errors. When
>I change the code so the procedures are in the same Packages, its OK.
>
>ie. If I create identical proc1's in packageA and packageB:
>In packageA
> packageB.proc1(record1); FAILS TO COMPILE
>whilst
> packageA.proc1(record1); IS OK
>
>Its a bit confusing! Any help anyone....
>
>Robert
>

You are probably defining the record type more then once. Once you define a record -- if you define it EXACTLY the same in another package -- that is a different record.

You should:

create or replace packageA
as

    record definition X goes here;

    procedure proc1( p_x in X );
end;
/

and then, in all other routines outside of this package ,you will always:

is

    my_record packageA.x;
begin

    packageA.proc1( my_record );
end;

that is - they will all use the single, same type definition from packageA -- else they are in fact the wrong type.

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Jan 27 2000 - 14:58:08 CST

Original text of this message

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