Solved

Calling Oracle Stored Procedure from Visual Basic

Posted on 2001-09-17
6
227 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Notepad++ how to remove delimiter : from beggning of the line? 3 106
using web browser with BING 40 122
C# LINQ ForEach() question 6 28
backup program with robocopy 6 23
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

803 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