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 -> function return recordset definition in a package

function return recordset definition in a package

From: <nospamdrew_at_gmail.com>
Date: 10 Apr 2007 15:36:20 -0700
Message-ID: <1176244580.674544.11200@n76g2000hsh.googlegroups.com>


I 'adopted' this code and have figured out 90% of what the package is doing. However, the code below reflects the remaining 10% I just can't get sorted out and understand how it determines the field names and sizes on the function return.

Background
A package in this package returns a DATE field to out_rec, but out_rec has that field defined as varchar2(7). This causes a procedure to fail and no results table is created. I get a "field too small" message.

Problem
How do I see the definition (field name and format) for the "RETURN t_TabScore" on the function definition... and/also/or, how about the definition for out_rec (or t_RecScore) from within f_score? I need to change that definition to a date-friendly format.

The call to f_score looks like this:
CREATE TABLE drew_tbl001 AS SELECT /*+ PARALLEL(q,16) */ * FROM TABLE(drew_pkg.f_score(CURSOR( .....<blah blah blah>

Notes
1) The following code lists all occurrences and references of t_TabScore
2) The following code lists all occurrences and reference of t_RecScore
3) I get no errors during package compilation 4) The package runs successfully if I skip loading the 'date field' in f_score

alter session set plsql_warnings='enable:all,warning:off'

create or replace package drew_pkg ....

   TYPE t_Refcur IS REF CURSOR RETURN t_RecMCD ;    TYPE t_Cursor IS REF CURSOR ;

   FUNCTION f_score ( pMCD t_refcur )

        RETURN t_TabScore
        PARALLEL_ENABLE (PARTITION pMCD BY HASH (individual_key))
        PIPELINED ;


<other functions and procedures not listed here. Nothing > <references the pl/sql variables/structures in question >

end;

create or replace PACKAGE BODY drew_pkg
IS

FUNCTION f_score ( pMCD t_refcur )
RETURN t_TabScore

    PARALLEL_ENABLE (PARTITION pMCD BY HASH (individual_key))     PIPELINED
 IS

--<<right here>> ....how do I see the field name and format for out_rec??

       out_rec   t_RecScore;
        in_rec    pMCD%ROWTYPE;


     BEGIN
     LOOP
            FETCH pMCD INTO in_rec;
            EXIT WHEN pMCD%NOTFOUND;

           out_rec := t_RecScore(
                   NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL

,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL
,NULL );
<snip. code cut out > END LOOP ;

    CLOSE pMcd ;
    return
end;

<other functions and procedures not listed. Nothing > <references the pl/sql variables in question >

end ;

drew Received on Tue Apr 10 2007 - 17:36:20 CDT

Original text of this message

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