using pipelined function with TOraQuery

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ThomasB
Posts: 6
Joined: Tue 09 Nov 2004 13:50
Location: Hannover, Germany

using pipelined function with TOraQuery

Post by ThomasB » Thu 02 Dec 2004 20:18

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

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Tue 07 Dec 2004 09:17

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');

Post Reply