I have Oracle function declared as
create or replace FUNCTION CheckScan(
pMode IN number,
pAgrISN in number,
pAgrId in varchar2,
pDocISN in number,
pRefundId in varchar2) RETURN NUMBER IS ...
And client Visual Basic 6 code that connects to Oracle as administrator like:
…
cmd.ActiveConnection = conn
cmd.CommandText = "CheckScan"
cmd.CommandType = 4 'adCmdStoredProc
Dim pMode As Integer
Dim pAgrISN As Integer
Dim pAgrId As String
Dim pDocISN As Integer
Dim pRefundId As String
pMode = 2
pAgrISN = 12345
pAgrId = "Some-Id"
pDocISN = 12345
pRefundId = "Some-id"
cmd.Parameters.Append cmd.CreateParameter("pMode", 131, 1, 10, pMode)
cmd.Parameters.Append cmd.CreateParameter("pAgrISN", 131, 1, 10, pAgrISN)
cmd.Parameters.Append cmd.CreateParameter("pAgrId", 200, 1, 255, pAgrId)
cmd.Parameters.Append cmd.CreateParameter("pDocISN", 131, 1, 255, pDocISN)
cmd.Parameters.Append cmd.CreateParameter("pRefundId", 200, 1, 255, pRefundId)
cmd.Execute
This code ends with:
PLS-00221: "CHECKSCAN" is not a procedure or is undefined
What is wrong here? Function was compiled successfully.
Thank you in advance!
Since you have a function (and not a procedure), you have to do something with the return value. Add the following parameter:
Update:
The order of the parameters is relevant. It must start with the return type. Then all parameters of the function must follow in the order they were declared. The names of the parameters are irrelevant however because positional (and not named) parameters are used internally. This is obvious if you look at the
CommandTextproperty ofcmd: