calling oracle function from asp Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: calling oracle function from asp

  1. #1
    Join Date
    Apr 2004

    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
    num_of_keyset number :=0;
    cursor bc_cur is
    select count(*) as num from mydb
    where key_set1=keyset_in;
    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;
    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.


  2. #2
    Join Date
    Jun 2000
    Madrid, Spain
    try from a sql statement, something like

    strSQL="SELECT count_qty(?) from dual"
    objConn.execute (strSQL)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width