How to Execute an Oracle SQL Statements with VBScript
Posted
by
Arno Conradie
on Stack Overflow
See other posts from Stack Overflow
or by Arno Conradie
Published on 2009-07-09T13:10:34Z
Indexed on
2012/07/07
21:16 UTC
Read the original article
Hit count: 203
I am trying to execute an Oracle SQL statement or Oracle Functions through Microsoft VBScript and the loop throught the result set or display the value returned by the function
So far I have managed to connect to Oracle via SQLPlus*, but now I am stuck. Can anybody help?
Dim output
Dim WshShell, oExec, input
set WshShell = CreateObject("WScript.Shell")
set oEnv=WshShell.Environment("Process")
cmdString = "C:\Oracle\11g\product\11.1.0\ruby\BIN\sqlplus.exe -S stradmin/stradmin@ruby select * from dual"
Set oExec = WshShell.Exec(cmdString)
WScript.Echo "Status" & oExec.Status
Do While oExec.Status = 0
WScript.Sleep 2
Loop
input = ""
Do While Not oExec.StdOut.AtEndOfStream
input = input & oExec.StdOut.Read(1)
Loop
wscript.echo input
© Stack Overflow or respective owner