calling oracle function from asp
I am very new in oracle pl/sql, and I have been struggling the simple test for a while.
I created a function in Oracle db console. The syntax is:
create or replace function count_qty(keyset_in in varchar2)
return number
as
num_of_keyset number :=0;
cursor bc_cur is
select count(*) as num from mydb
where key_set1=keyset_in;
begin
if keyset_in is not null then
open bc_cur;
fetch bc_cur into num_of_keyset;
close bc_cur;
end if;
return num_of_keyset;
end;
/
This function is succesfully created.
Then I call it from asp page:
....db connect above
keyset = Request.form("keyset")
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = Connect
cmd.CommandText = "count_qty(?)"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("keyset",adVarChar,adParamInput, 20)
set objrs=cmd.Execute
response.write objrs("num")
set cmd=nothing
set objrs=nothing
...
html form with a texbox called "keyset"
The error message is "No value given for one or more required parameters". There might be some other errors in the code. Please help.
Thanks