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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Passing TYPEs to Procedures

Re: Passing TYPEs to Procedures

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Fri, 28 Aug 1998 13:01:21 GMT
Message-ID: <35e6a73d.1091940@dcsun4.us.oracle.com>


On Thu, 27 Aug 1998 21:46:55 GMT, rguarisc_at_allstate.com wrote:

>Oracle Experts,
>
>I'm trying to create a RECORD TYPE in one procedure, fill it with some data,
>and pass it along as a whole to another procedure. Is this possible? Here's
>the code snippets...
>
>PROCEDURE PROCA IS
>
> TYPE workrec_type IS RECORD
> (
> ACTION VARCHAR2(1),
> FACTOR NUMBER(38,16),
> RUN_ID VARCHAR2(10)
> );
>
> work_record workrec_type;
>
>BEGIN
>
> work_record.run_id := run_id;
>
> PROCB(work_record);
>
>....
>
>END;
>-------------------
>PROCEDURE PROCB( passed_work_record IN {what do I use here???})
>IS
>
>BEGIN
>...
>END;
>
>I've tried a lot of different combinations such as:
>
>pass_work_record%workrec_type
>workrec_type%ROWTYPE
>workrec_type%TYPE
>workrec_type%RECORD
>
>Please help!

You need to globally define the record type in a package so that both procedures know about it.

try:

create or replace
package type_package is
  type workrec_type is record
  (
    action varchar2(1),
    factor number(38,16),
    run_id varchar2(10)
  );
end type_package;
/

Now both PROCA and PROCB can declare variables and parameters with the type of type_package.workrec_type

eg.

create or replace
procedure procb( passed_work_record type_package.workrec_type ) as begin
  null;
end procb;
/

or

create or replace
procedure proca as
  work_record type_package.workrec_type; begin
  work_record.run_id := 'XXXXX';
  procb( work_record );
end proca;
/

hope this helps.

chris.

>
>Thanks,
>Ron.
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Received on Fri Aug 28 1998 - 08:01:21 CDT

Original text of this message

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