Bug in OraStoredProc?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
hao2013
Posts: 4
Joined: Wed 11 Sep 2013 07:23

Bug in OraStoredProc?

Post by hao2013 » Wed 11 Sep 2013 07:27

Hi,
I want to call a stored procedure return a cursor, but I found, I execute a stored procedure and return a Bug using OraStoredProc, in fact he executed multiple times, or two calls a stored procedure.
A deposit paid storage content
CREATE OR REPLACE PROCEDURE test
(cur out curvar)
Is
Vlsh number (8);
Begin
Select lsh_seq.nextval into vlsh from dual;
Insert into tabtest (AA) values (vlsh);
Open cur for select * from tabtest;
End;
Please help to see where is the problem?
Hao

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Bug in OraStoredProc?

Post by AlexP » Wed 11 Sep 2013 08:44

Hello,

Please specify the exact versions of your IDE and ODAC, server and client, also the text or a screenshot of the error message. In addition, provide the script for creating the curvar type.

hao2013
Posts: 4
Joined: Wed 11 Sep 2013 07:23

Re: Bug in OraStoredProc?

Post by hao2013 » Wed 11 Sep 2013 08:48

Delphi XE4, ODAC 9.0.1

In addition, I want to perform this step
Var
Ret:OleVariant;
Begin
OraQuery1.SQL.Text: ='begin (test: CUR); end;';
OraQuery1.ParamByName ('CUR'):.DataType = ftCursor;
OraQuery1.Open;
RET: = DataSetProvider1.Data;
A fault.

hao2013
Posts: 4
Joined: Wed 11 Sep 2013 07:23

Re: Bug in OraStoredProc?

Post by hao2013 » Wed 11 Sep 2013 09:04

Oracle 10.2.0.1(OCI)

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  OraQuery1.SQL.Text := 'begin yp_test(:CUR); end;';
  OraQuery1.ParamByName('CUR').DataType := ftCursor;
  OraQuery1.Open;
  ClientDataSet1.Data := DataSetProvider1.Data;  //The first execute a stored procedure that returns a record;Second to execute the stored procedure returns three records
end;


AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Bug in OraStoredProc?

Post by AlexP » Wed 11 Sep 2013 11:27

Hello,

Such behaviour is due to the fact that you firstly call Open of OraQuery (a stored procedure is executed), and then recall OraQuery execution on assigning ClientDataSet1.Data := DataSetProvider1.Data;
To solve the problem, you should delete the OraQuery1.Open; line.

hao2013
Posts: 4
Joined: Wed 11 Sep 2013 07:23

Re: Bug in OraStoredProc?

Post by hao2013 » Wed 11 Sep 2013 11:58

AlexP,Thanks.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Bug in OraStoredProc?

Post by AlexP » Wed 11 Sep 2013 12:39

Hello,

If you have any other questions, feel free to contact us

Post Reply