#DEFINE CONNECT_STRING "Provider=MSDAORA.1;Data Source=MyServer;User ID=MyUser;Password=MyPwd" LOCAL cn, rs, cmd, param, SQL cn = CreateObject( "ADODB.Connection" ) cn.Open ( CONNECT_STRING ) cmd = CreateObject ("ADODB.Command") *!* It works this way, with a parameter object and also works the 2nd way, *!* with the parameter embedded within the command. *!* SQL = "{call TestRefCursor.GetData(?, {resultset 0, io_cursor})}" *!* with cmd *!* .ActiveConnection = cn *!* .CommandText = SQL *!* .CommandType = 1 && adCmdText *!* param = .CreateParameter("n_EmpNo", 131 , 1 , , 2) && 131=adNumeric, 1=adParamInput *!* .Parameters.Append ( param ) *!* endwith * Note that passing "resultset 0" gets all records. SQL = "{call TestRefCursor.GetData(2, {resultset 0, io_cursor})}" with cmd .ActiveConnection = cn .CommandText = SQL .CommandType = 1 && adCmdText endwith rs = cmd.execute IF VARTYPE ( rs ) = "O" WITH rs IF NOT .Eof FOR EACH oField IN rs.Fields ? oField.Name, oField.Value NEXT oField ENDIF ENDWITH ENDIF STORE .F. TO rs, cmd, cn, paramThe Oracle package for TestRefCursor, a simplfied version of what's in the KB article, looks like this:
CREATE OR REPLACE PACKAGE testrefcursor AS TYPE t_cursor IS REF CURSOR ; Procedure GetData (n_PK IN NUMBER, io_cursor IN OUT t_cursor); END; / CREATE OR REPLACE PACKAGE BODY testrefcursor AS Procedure GetData (n_PK IN NUMBER, io_cursor IN OUT t_cursor) IS v_cursor t_cursor; BEGIN OPEN v_cursor FOR SELECT * FROM MyTable WHERE pk = n_PK; io_cursor := v_cursor; END; END; /