Page 1 of 1

using pipelined function with TOraQuery

Posted: Thu 02 Dec 2004 20:18
by ThomasB
Hello,

a pipelined function belongs to a package. The necessary types are declared gobally for the schema.

FUNCTION GET_ZP_STANZLISTE(dtStart IN DATE, dtEnde IN DATE)
RETURN ttblZPSTANZLISTE PIPELINED;

In SQL*Plus I can do:

SELECT *
FROM TABLE(CAST(PKG_STANZLISTEN.GET_ZP_STANZLISTE(to_date('01.01.2005', 'dd.mm.yyyy'), to_date('31.12.2005', 'dd.mm.yyyy')) AS ttblZPSTANZLISTE));

This query returns the expected rows and I can treat it like any other query against a table.

But how can I use the pipelined function inside a TOraQuery with parameters?

I tried:

begin
:RESULT := claudio_admin.PKG_STANZLISTEN.GET_ZP_STANZLISTE(:DTSTART, :DTENDE);
end;

This code was created by the Stored Procedure Call Generator. After setting :DTSTART and :DTENDE and trying to open the query I get the error message "Type of object must be defined".

Thanks for your help,
Thomas

Posted: Tue 07 Dec 2004 09:17
by Paul
You cannot use PIPELINED and AGGREGATE functions in PL/SQL blocks outside of
SELECT statement.
You will receive this error message when you try to create an instance of the object

Code: Select all

  with SmartQuery1.ParamByName('Result').AsObject do
    AllocObject(OraSession1.OCISvcCtx, 'ttblZPSTANZLISTE');