Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to fetch and pipe row object in PIPELINED procedure

822262Dec 5 2011 — edited Dec 5 2011
I'm stuck and cannot find proper example on Internet.

I have object definitions and temporary object table like below:
create type EPAC_LOCATION_ROW_DATA as object (
      PHYS_INVN_CODE      varchar2(8 char)
    , PRINT_REQUEST_ID    varchar2(20 char)
    , CNT_NBR             number(1)
    , DSP_LOCN            varchar2(10 char)
    , LAST_USER_ID        varchar2(255 char)
    , RQST_USER_ID        varchar2(255 char)
    , LAST_TSTAMP         timestamp(6)
    , RQST_TSTAMP         timestamp(6)
    , ROW_NUMBER          number(9,0)
  );

create type EPAC_LOCATION_TABLE as table of EPAC_LOCATION_ROW_DATA;

create global temporary table EPAC_LOCATION_STACK of EPAC_LOCATION_ROW_DATA
    on commit delete rows;
It's fine and no problems here, it seems.

I'm testing behavior of my new procedure (part of large package):
function ZONES_TO_COUNT_1ST (
    in_locn_class       in varchar2,
    in_zone             in varchar2,
    in_cnt_nbr          in number,
    in_rqst_user_id     in varchar2,
    in_print_reqst_id   in varchar2
)
return EPAC_LOCATION_TABLE pipelined
as
    cursor location_stack is
        select value(locns)
          from EPAC_LOCATION_STACK locns;
          
    the_zone_line     EPAC_LOCATION_ROW_DATA;
begin
    PUSH_ZONES_TO_COUNT ( in_locn_class, in_zone, in_cnt_nbr, in_rqst_user_id, in_print_reqst_id );
        the_zone_line := EPAC_LOCATION_ROW_DATA(
                    'TEST1205',
                    'ABCDEFGHIJKLMNOPQRST',
                    1,
                    'TEST1205a',
                    'TEST',
                    'TEST',
                    systimestamp,
                    systimestamp,
                    1
                );
        pipe row ( the_zone_line );

    for the_zone_line in location_stack
    loop
        pipe row ( the_zone_line );
    end loop;
end;
When compiling I get an error PLS-00382: expression is of wrong type in line:
        for the_zone_line in location_stack
        loop
****        pipe row ( the_zone_line );
        end loop;
I don't get it. I can pipe row an object when creating it directly but I cannot when it's fetched?

Is the problem in "select value(locns)" or somewhere else?

Edited by: Zbig on 2011-12-05 00:56
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2012
Added on Dec 5 2011
1 comment
174 views