My VB application is connecting to the Oracle database fine and I can run many SQL statements through ADO connection. However, when I try to execute a stored PL/SQL procedure, it does'nt work.
Does anybody have an ideahow to execute Oracle stored procedures from VB?
Or through Shell commands?
09-26-2001, 01:38 AM
ales
Since you didn't post any piece of code I can just say that people often forgot to use BEGIN and END.
Set param = comm.CreateParameter("name", adVarChar, adParamInput, Len(variable), actual value)
comm.Parameters.Append param
comm.Execute
set comm = nothing
conn.close
set conn = nothing
The second way is the pro way to do it . It gives more control on the code .
Hope this helps
Happy Programming
Regards
Shailesh
09-26-2001, 07:35 AM
mageri
Hi,
You can use the UTL_FILE package insted of the DBMS_OUTPUT package. UTL_FILE lets your PL/SQL programs read and write operating system (OS) text files.
Include the init.ora file with the parameter UTL_FILE_DIR='path to a directory where you want the output file'.
Read more in the doc. how to use the UTL_FILE package.
Maybe some hint!?
09-26-2001, 07:45 AM
ales
You can't see output of dbms_output package in VB, AFAIK.
For "reports" from inside of stored procedures I usually use OUT parameter. Procedure stores required output information in a VARCHAR2 variable and passes it back via the parameter.
HTH,
Ales
09-27-2001, 01:31 AM
Raminder
Thanks
Thanks Ales and all you helpful guys out there.
Ales, can you give an example of getting the OUT parameter on VB?
I tried to get the OUT parameter onto a text box, but failed.
.....
......
Dim X, Y as Integers
X=text1.text
con.execute("begin myprocedure("+X+","+Y");end;")
text2.text=Y
end sub
I get a type mismatch error in VB.
10-01-2001, 07:48 AM
ales
Hi, I'm sorry for delay.
I use the OUT parameters in Java and VB/OO4O so I'm not able to give you an advice for ADO.
kshailesh's post above seems to show good way. You'll have to see help for syntax to get the value of OUT parameter.
Regards,
Ales
10-02-2001, 04:25 AM
Raminder
Eureka!
I could get it right. This is how:
Dim VALUE1 As Double
VALUE1 = Text1.Text
comm.activeconnection = con
comm.CommandText = " {CALL TEST1 (?,?) }"
comm.Parameters(0) = VALUE1
comm.Execute
Text2.Text = comm.Parameters(1)
WHERE COMM IS ADODB.COMMAND
& CON IS ACTIVE CONNECTION
TEST1 IS MY ORACLE PROCEDURE