Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How To Execute a Stored Procedure on an Oracle Server


View products that this article applies to.

This article was previously published under Q149882

↑ Back to the top


Summary

This article describes how to use SQL pass-through technology to execute a stored procedure on an Oracle server. Oracle does not use the standard SQL EXECUTE command to execute stored procedures.

↑ Back to the top


More information

This example executes a stored procedure called SP_MYPROC. It is assumed that you have a valid ODBC datasource configured for the Oracle server. This example assumes that you have created a valid datasource called "ORADSN." This article does not cover the steps necessary to create a valid datasource. This article shows the proper syntax necessary to call a stored procedure called "SP_MYPROC," which has no parameters, using Visual FoxPro. For information on creating stored procedures in Oracle see your Oracle documentation:
*************************************
** Description of variables used  **
* h = handle
* ORADSN = datasource name
* USERID   = user id
* PWD        = password
**************************************

   h=SQLConnect("ORADSN","USERID","PWD")   && Establish a connection

   IF h > 0

      WAIT WINDOW "Connection Successful" NOWAIT
      =SQLExec(h,"{Call SP_MYPROC}")       && Execute the stored procedure
      =SQLDisconnect(h)                    && Terminate the connection

   ELSE

      WAIT WINDOW "Connection Failed"

   ENDIF
				
NOTE: The 32-bit Visigenic Oracle ODBC driver that ships with Visual FoxPro 3.0b and many other 32-bit Microsoft products does not support the execution of stored procedures.

NOTE: As of Dec-09-1998, Visigenic was acquired by INPRISE, Inc.

For more information about hardware and software vendor contact information, visit the following Microsoft Web site: -

↑ Back to the top


Keywords: KB149882, kbinterop, kbhowto, kbcode

↑ Back to the top

Article Info
Article ID : 149882
Revision : 7
Created on : 3/14/2005
Published on : 3/14/2005
Exists online : False
Views : 543