Page 1 of 1

how to use cursor [resolve]

Posted: Thu 02 Aug 2007 11:53
by hip
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

Posted: Fri 03 Aug 2007 07:50
by Plash
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.

Posted: Fri 31 Aug 2007 12:16
by hip
oops

I wrote [resolve] but I forgot to thank you

So thx for reply Plash