ToeJamNEarl
Programmer
Hello guys,
How would I pass in an array to a stored procedure?
The PL\SQL package is as follows:
The Visual Basic code I am currently using to call this Stored procedure is as follows:
It errors out during debug when it gets to the line:
Please can someone help me figure out how ot pass in an Array to a stored procedure?
Thanks
-Diran
How would I pass in an array to a stored procedure?
The PL\SQL package is as follows:
Code:
package test_varray is
TYPE t_InputFields IS VARRAY(4) OF VARCHAR2(5);
PROCEDURE Test_Array(p_InputFields IN t_InputFields,
P_Field1 IN OUT VARCHAR2,
P_Field2 IN OUT VARCHAR2,
P_Field3 IN OUT VARCHAR2,
P_Field4 IN OUT VARCHAR2) ;
end test_varray;
The Visual Basic code I am currently using to call this Stored procedure is as follows:
Code:
Dim datCmd1 As New ADODB.Command
Dim prmInputFields As New ADODB.Parameter
Dim i As Integer
Dim InputFields(1 To 4) As String
strPF1 = ""
strPF2 = ""
strSF1 = ""
strSF2 = ""
rsTMPSF.MoveFirst
Do While rsTMPSF.EOF = False
If (cboPrimary1.Text) = rsTMPSF(0).Value & " - " & rsTMPSF(1).Value Then
strPF1 = rsTMPSF(0).Value & "." & rsTMPSF(2).Value
End If
If (cboPrimary2.Text) = rsTMPSF(0).Value & " - " & rsTMPSF(1).Value Then
strPF2 = rsTMPSF(0).Value & "." & rsTMPSF(2).Value
End If
If (cboSecondary1.Text) = rsTMPSF(0).Value & " - " & rsTMPSF(1).Value Then
strSF1 = rsTMPSF(0).Value & "." & rsTMPSF(2).Value
End If
If (cboSecondary2.Text) = rsTMPSF(0).Value & " - " & rsTMPSF(1).Value Then
strSF2 = rsTMPSF(0).Value & "." & rsTMPSF(2).Value
End If
rsTMPSF.MoveNext
Loop
InputFields(1) = strPF1
InputFields(2) = strPF2
InputFields(3) = strSF1
InputFields(4) = strSF2
datCmd1.ActiveConnection = DBConnection
datCmd1.CommandType = adCmdStoredProc
datCmd1.CommandText = "test_varray.test_array"
Set prmInputFields = datCmd1.CreateParameter("p_InputFields", adArray, adParamInput)
datCmd1.Parameters.Append prmInputFields
prmInputFields(1).Value = InputFields(1)
prmInputFields(2).Value = InputFields(2)
prmInputFields(3).Value = InputFields(3)
prmInputFields(4).Value = InputFields(4)
datCmd1.Execute
It errors out during debug when it gets to the line:
Code:
Set prmInputFields = datCmd1.CreateParameter("p_InputFields", adArray, adParamInput)
Please can someone help me figure out how ot pass in an Array to a stored procedure?
Thanks
-Diran