Q
Problem solve Get help with specific problems with your technologies, process and projects.

Executing an Oracle stored procedure in Oracle from SQL Server

Hi Mike, you stated in one of your earlier answers that it is possible to execute an Oracle stored procedure in Oracle from SQL Server 7.0/2000 via DTS. I have not yet found any other documentations backing up this statement. Could you give me the step by step procedure with the proper syntax to successfully run this task?

Here is a direct excerpt from BOL that shows getting data from an Oracle package.

"Issuing Distributed Queries Against Package Data"
You can register a Data Transformation Services (DTS) package as a linked server and issue a distributed query against the package. This capability allows you to consolidate data from diverse sources (for example, from Oracle and DB2 data sources) in a single package, transform that data, and expose the results of the transformed distributed query to any outside data consumer.

To issue a distributed query against package data, you need to define the package as a linked server through the sp_addlinkedserver stored procedure. The following example code illustrates how to use sp_addlinkedserver against a DTS package:

sp_addlinkedserver 'DTSOLEDBPkg', 'PackageName', 'DTSPackageDSO', 
'/FC:\Dts\Dts01.dts') 
In the sp_addlinkedserver command:

DTSOLEDBPkg is the name of the linked server you want to create.

PackageName is the product name of the OLE DB data source; in this context, you can provide any name or a null string.

DTSPackageDSO is the name of the DTS package OLE DB Provider.

The last argument specifies the location of the file, DTS01.dts. After you have defined the package as a linked server, you can execute distributed queries that include the package as a data source. Following is an example of a distributed query. It performs a join operation on the Orders table in the Northwind database with a package that gets data from a Customer table on an Oracle server. The query assumes the Orders and Customers tables have a common key, which is CustomerID.

SELECT a.OrderID, a.CustomerID, a.OrderDate, b.Companyname, b.Region 
FROM Orders AS a, dtsLink...packageNameOracle AS b 
WHERE a.CustomerID = b.CustomerID 
In the above query, packageNameOracle is the DTS package name. However, you can use a package step name when multiple steps in a package serve as data sources."

1988-2000 Microsoft Corporation. All Rights Reserved.

For More Information

This was last published in August 2002

Dig Deeper on SQL Server Stored Procedures

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close