I have create a global temporary table in oracle database as follows
Create global temporary table tmpDataGroup
(
DATAGROUPID number(15),
DESCRIPTION VARCHAR2(50)
) ON COMMIT Delete ROWS ;
Then I create following package and stored procedure.
CREATE OR REPLACE PACKAGE sp_getData AS
TYPE cursor_Data IS REF CURSOR;
END sp_getData;
CREATE OR REPLACE PROCEDURE sp_GetTestData1(
io_cursor IN OUT sp_getData.cursor_Data
)
AS
BEGIN
INSERT INTO tmpDataGroup SELECT * FROM DATAGROUP;
OPEN io_cursor FOR
SELECT * FROM tmpDataGroup;
END sp_GetTestData1;
When I call sp_GetTestData1 from following strored procedure, it works fine. Records returns ( DataGroup table contains 12 rercords).
But when I call sp_GetTestData1 from visual basic 6, no records returns. I use follow
Vb code.
Dim cmd As ADODB.Command
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim SpName As String, CONNECTION_STRING As String
Set cmd = New ADODB.Command
SpName = "sp_getTestData1"
CONNECTION_STRING = "File Name=" & App.Path & "\MyDataLink.UDL"
Set rst = New ADODB.Recordset
With cmd
Set rst = New ADODB.Recordset
.ActiveConnection = CONNECTION_STRING
.CommandType = adCmdStoredProc
.CommandText = SpName
.Properties("PLSQLRSet") = True
'rst.Open cmd, , adOpenForwardOnly, adLockReadOnly
Set rst = .Execute()
End With
If Not rst.EOF Then
recArray = rst.GetRows()
reccount = UBound(recArray, 2) - LBound(recArray, 2) + 1
End If
MsgBox (reccount)
Set rst = Nothing
Set cmd = Nothing
I will be very pleased if any one can tell me what is the problem.