Solved

Calling Oracle Stored Procedure from Visual Basic

Posted on 2001-09-17
6
225 Views
Last Modified: 2013-11-25
I am using Visual Basic 6 with Oracle 8i Database at the backend.
I have written a stored procedure on Oracle which has one input parameter and one output parameter.
How can i call the stored procedure from visual basic . I need to pass the input parameter while calling the procedure and store the result returned by Procedure via output parameter.

Thank You,

Naresh
0
Comment
Question by:ATIRAS
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:lyonst
ID: 6487252
0
 
LVL 15

Expert Comment

by:lyonst
ID: 6487275
Also,

HOWTO: Call a Parameterized Stored Procedure in Oracle from a Recordset DTC

http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q240337

Cheers,

T.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6487417
I do something similar to:

Set cmd = New ADODB.Command
With cmd
   .ActiveConnection = "connection string goes here"
   .CommandType = adCmdStoredProc
   .CommandText = "package.storedproc"
   .Parameters.Append .CreateParameter("inputvar", adChar, adParamInput, 100, "inputvar value")
   .Parameters.Append .CreateParameter("o_status", adInteger, adParamOutput)
   .Execute Options:=adExecuteNoRecords
End With

Debug.Print cmd("o_status").Value

Set cmd = Nothing

Anthony
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6487420
Also, when you get a chance, please maintain your open questions.  For the record:

Questions Asked 8
Last 10 Grades Given  
Question Grading Record 0 Answers Graded / 0 Answers Received
0
 

Accepted Solution

by:
krs_rama earned 100 total points
ID: 6489434
hi,
The following codes would sove your problem

With cmd
 
  .ActiveConnection = oradb  'Opening connection for Stored proc-
     'oradb is opened using the normal Ado Open and i tried with scott/tiger by creating a
     'stored procedure named pp with one number parameter
 
 
  Dim IntValue, IntRecsAffected As Integer
  IntValue = 120  'value passed (ONE PARAMETER ) to test the procedure
 
  .CommandType = adCmdStoredProc
  .CommandText = "PP"   'pp  denotes the procedure name
  .Parameters.Append .CreateParameter("intvalue", adInteger, adParamInput, 20, 20)
  .Execute IntRecsAffected, IntValue, Options:=adExecuteNoRecords
 
End With

Set cmd = Nothing

i have tried the above codes and the stored procedure works !

Regards,
Krs_rama
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6492291
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

746 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

17 Experts available now in Live!

Get 1:1 Help Now