I am working with Oracle 10g my table has a Sequence and a trigger to insert the ClassesID into the record. I am trying to get an ID back from an Insert I have seen that we can use a query like "INSERT INTO Classes(Reason) VALUES('Bob was Here') returning ClassesID into : val1" Unfortunatly I have not been able to get this to work. When I run the following code I get the error of "[Oracle][ODBC][Ora]ORA-01008: not all variables bound " When I remove the following lines I get "Unspecified error":
v_output = parOutput.Value
Response.write("ClassesId = " & v_output)

Can any one pleas help?


Here is my code.
dim v_output, parOutput
Dim val1
Dim pDataConn, pDataCom, objRS

Set pDataCom = Server.CreateObject("ADODB.Command")

With pDataCom
'setup command object
.ActiveConnection = "User ID=TestUser;Password=TestPassword;Data Source=Test;"
.CommandText ="INSERT INTO Classes(Reason) VALUES('Bob was Here') returning ClassesID into : val1"
.CommandType = adCmdText

' Appending parameters
Set parOutput = .CreateParameter("val1", adVarNumeric, adParamOutput)
.Parameters.Append(parOutput)

' calling my sp
Call .Execute


' getting the result from output parameter.
v_output = parOutput.Value
Response.write("ClassesId = " & v_output)

End with