I am trying to call a PL/SQL block with ADO and VBA, but I can't pass input and/or output bind variables (probably aka parameters).
dim cn as ADODB.connection
' ... open connection ...
dim plsql as string
plsql = "declare"
plsql = plsql & " num_in number := ?;"
plsql = plsql & " num_out number; "
plsql = plsql & "begin"
plsql = plsql & " num_out := num_in * 5;"
plsql = plsql & " ? := num_out;"
plsql = plsql & "end;"
dim cm as ADODB.command
set cm = new ADODB.command
set cm.activeConnection = cn
cm.commandText = plsql
cm.commandType = adCmdText
cm.parameters.append cm.createParameter(, adDouble, adParamInput,, 5)
cm.parameters.append cm.createParameter(, adDouble, adParamOutput )
cm.execute ' FAILS HERE
msgBox(cm.parameters(2))
The snippet above fails at the cm.execute
line with an ORA-01008: not all variables bound
I'd appreciate any help towards a solution for my problem.