Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Calling Oracle Stored Procedure from Visual Basic

Posted on 2001-09-17
6
229 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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