[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

Calling Oracle Stored Procedure from Visual Basic

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
ATIRAS
Asked:
ATIRAS
  • 3
  • 2
1 Solution
 
lyonstCommented:
0
 
lyonstCommented:
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
 
Anthony PerkinsCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Anthony PerkinsCommented:
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
 
krs_ramaCommented:
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now