how to use cursor [resolve]

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
hip
Posts: 6
Joined: Thu 02 Aug 2007 11:33

how to use cursor [resolve]

Post by hip » Thu 02 Aug 2007 11:53

Hey,

--Odac V5.55.1.26
--Delphi7
--Oracle 9.2.0.1.0

I would to use a "Return of cursor from a stored procedure or anonymous PL/SQL block (by parameter)"

I would to know how I must use a return of cursor with Delphi

--PL/SQL
PROCEDURE req_test(
curseur IN OUT req_test_cur) IS
BEGIN
OPEN curseur
FOR SELECT 'test' test
FROM DUAL;
END;

--DELPHI
with DataProc.PROC_TEST do
begin
execute;
while not eof do
begin
MessageDlg(FieldByName('TEST').AsString,mtWarning,[mbOk],0);
next;
end;
end;

It's all right? :? Or I must close the cursor too? If yes, how?

Thx for help
Last edited by hip on Fri 03 Aug 2007 09:31, edited 2 times in total.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 03 Aug 2007 07:50

You should call the Close method of the TOraStoredProc component. This will close the cursor.
To execute stored procedure that returns a cursor, it's better to use the Open method of the TOraStoredProc component instead of the Execute method. However, using the Execute method is also correct.

hip
Posts: 6
Joined: Thu 02 Aug 2007 11:33

Post by hip » Fri 31 Aug 2007 12:16

oops

I wrote [resolve] but I forgot to thank you

So thx for reply Plash

Post Reply