the way to get cursor parameter at package in oracle

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
daizhicun
Posts: 109
Joined: Thu 21 Jan 2010 11:49

the way to get cursor parameter at package in oracle

Post by daizhicun » Thu 06 May 2010 11:41

in oracle, we can get DataSet by package useing Cursor paramter;

But if a package has multiple Cursor paramters;

If useing UniDAC,how to get every cursor by TuniQuery or TUniStoreProc;

we know that the famous tool for oracle develoer: Pl/sql developer;

It can call every Cursor paramter of Package easy:

for example:

Image

but it is not easy in TuniQuery or TUniStoreProc;
TuniQuery can noly get the first cursor parameter;
it only has UniQuery.OpenNext ; it has no UniQuery.OpenPrior;
Image

i hope that:
UniQuery.ParamByName('cursor1').open;
UniQuery.ParamByName('cursor2').open;
UniQuery.ParamByName('cursor3').open;

daizhicun
Posts: 109
Joined: Thu 21 Jan 2010 11:49

Post by daizhicun » Thu 06 May 2010 11:43

the package code for the pic above:

CREATE OR REPLACE PACKAGE GetDataSet AS
TYPE TDataSet IS REF CURSOR;


PROCEDURE Get_data(

DataSet1 OUT TDataSet,
DataSet2 OUT TDataSet,
DataSet3 OUT TDataSet

);

END;
/
CREATE OR REPLACE PACKAGE BODY Getdataset IS


PROCEDURE Get_data(

DataSet1 OUT TDataSet,
DataSet2 OUT TDataSet,
DataSet3 OUT TDataSet

) as
begin
open DataSet1 for
select 1 as a from dual;

open DataSet2 for
select 2 as b from dual;
open DataSet3 for
select 3 as c from dual;
end;

END;

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Fri 07 May 2010 11:10

Hello

You should use TUniSQL to execute the following SQL:

Code: Select all

begin
  GetDataSet.Get_data(:cursor1, :cursor2, :cursor3);
end;
And you should execute the following code to get the result:

Code: Select all

begin
  UniSQL1.ParamByName('cursor1').DataType := ftCursor;
  UniSQL1.ParamByName('cursor2').DataType := ftCursor;
  UniSQL1.ParamByName('cursor3').DataType := ftCursor;

  UniSQL1.Execute;

  UniQuery1.Close;
  UniQuery1.Cursor := UniSQL1.ParamByName('cursor1').AsCursor;
  UniQuery1.Open;

  UniQuery2.Close;
  UniQuery2.Cursor := UniSQL1.ParamByName('cursor2').AsCursor;
  UniQuery2.Open;

  UniQuery3.Close;
  UniQuery3.Cursor := UniSQL1.ParamByName('cursor3').AsCursor;
  UniQuery3.Open;
end;

Post Reply