call Oracle Function from VBScript using ADO

Posted on 2007-09-28
Last Modified: 2013-12-12
I was looking everywhere and found bits and pieces and never really fully working sample... does anybody have VBScript Sample for calling Oracle Function using ADO, please only VBScript, no VB, no C++, no ASP .... fully working VBScript.

I currently use this driver and would like to keep it, I can use OLE DB but it has to be Microsoft OLE DB for Oracle

Driver={Microsoft ODBC for Oracle}

here is my oracle function


thanks a lot

Question by:playernovis
    LVL 73

    Accepted Solution

    Option Explicit

    Dim cnnDB
    Dim cmdDB
    Dim username
    Dim password
    Dim dbname
    Dim result
    Dim given_day
    Dim input_name

    username = "sds"
    password = "sdssds"
    dbname = "sdsora10"

    Set cnnDB = CreateObject("ADODB.Connection")
    cnnDB.provider = "MSDAORA"
    cnnDB.Open dbname, username, password

    ' Get recordset
    Set cmdDB = CreateObject("ADODB.Command")
    cmdDB.ActiveConnection = cnnDB
    cmdDB.CommandType = 4 'Stored Procedure
    cmdDB.CommandText = "test"

    Set result = cmdDB.CreateParameter("", 3, 4)  '3=Integer, 4 = Return Value
    Set given_day = cmdDB.CreateParameter("GIVEN_DAY", 135, 1,,Now)  '135=DBDate, 1 = Input
    Set input_name = cmdDB.CreateParameter("INPUT_NAME", 200, 1,10,"test-name")  '200=VarChar, 1 = Input

    cmdDB.Parameters.Append result
    cmdDB.Parameters.Append given_day
    cmdDB.Parameters.Append input_name

    MsgBox "Result = " & result.value
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
    Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
    This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
    This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now