• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4739
  • Last Modified:

call Oracle Function from VBScript using ADO

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

FUNCTION TEST ( GIVEN_DAY DATE, INPUT_NAME VARCHAR2) RETURN NUMBER;



thanks a lot
jiri

0
playernovis
Asked:
playernovis
1 Solution
 
sdstuberCommented:
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
cmdDB.execute

MsgBox "Result = " & result.value
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now