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: Coding Question about user-defined types as parameters

Re: Coding Question about user-defined types as parameters

From: Dereck L. Dietz <dietzdl_at_ameritech.net>
Date: Sun, 22 Apr 2007 00:46:39 GMT
Message-ID: <PfyWh.17462$JZ3.11598@newssvr13.news.prodigy.net>

<sybrandb_at_hccnet.nl> wrote in message
news:sr9j23d456tljucs2f47qos3oa9spc1r3t_at_4ax.com...
> On Fri, 20 Apr 2007 23:46:17 GMT, "Dereck L. Dietz"
> <dietzdl_at_ameritech.net> wrote:
>
> >I have a situation where I have a cursor of a subset of the columns in a
> >table:
> >
> >For example, if the base_table contains 10 total columns but only have 3
in
> >the cursor as
> >below:
> >
> > CURSOR cr_cursor
> > IS
> > SELECT column_1,
> > column_2,
> > column_3
> > FROM base_table;
> >
> >If I want to pass the cursor as a parameter to functions/procedures it
seems
> >as if I have to
> >specifically create a TYPE with hardcoded values for the columns:
> >
> > TYPE the_type IS RECORD
> > (
> > column_1 VARCHAR2(10),
> > column_2 VARCHAR2(10),
> > column_3 VARCHAR2(10)
> > );
> >
> >Instead of being able to create a TYPE like:
> >
> > TYPE the_type cr_cursor%ROWTYPE;
> >
> >If I create a procedure/function something like:
> >
> > PROCEDURE test( p_parameter IN the_type )
> >
> >Only the first version with the hardcoded columns will successfully
compile.
> >
> >Can anybody shed any light on what I'm doing wrong?
> >
>
>
> You need a subtype. SUBTYPEs will work.
>
> --
> Sybrand Bakker
> Senior Oracle DBA

Like this?:

SUBTYPE the_type cr_cursor%ROWTYPE;

And that will allow

PROCEDURE test(p_parameter IN the_type)

to compile?

Thanks. Received on Sat Apr 21 2007 - 19:46:39 CDT

Original text of this message

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