Executing Stored Procedures Remotely

Downloads
22268.zip

You can't use a linked server to execute an Oracle stored procedure from SQL Server. Even OPENQUERY and OPENROWSET can't get around that limitation. But you can update an Oracle table from a linked-server query. And if that Oracle table has an UPDATE trigger associated with it, any update will cause the trigger to fire. Furthermore, the trigger can execute a stored procedure. Consequently, by issuing an UPDATE statement, which is a permissible operation, you can indirectly make a stored procedure execute. The code in Listing A demonstrates this process.

First, the code creates an Oracle table. Next, it initializes the table by inserting a row and issuing a COMMIT. Then, the code creates an AFTER UPDATE trigger on the table. From Query Analyzer, you can then execute the following code to trigger the execution of the stored procedure:

UPDATE ORADB..SCOTT.EXEC_PROC_AFTER_UPDATE
SET UPDATE_THIS_TO_EXEC = 1

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottOur Experts will show you:
• Common SQL Server
Problems
• Best Practices for T-SQL
• SQL Server Integration
Services
• Database Development

Come See Michael Otey & Tim Ford in Person!

Early Registration Now Open

From the Blogs
May 21, 2013
blog

A Common Misconception about MAXDOP

Out of the box, SQL Server is (and has been) able to take advantage of multiple processors/cores without any effort on behalf of administrators....More
May 9, 2013
blog

My ISO 8601-Compliant Signature 2

My family recently just "officially" announced that we're in the process of adopting a child from South Africa. We're quite excited, of course, but there's a ton of paperwork to do—along with the need for gobs of signatures....More
May 8, 2013
blog

Use SSIS for ETL from Hadoop

In this blog post, Mark Kromer walks you through using SSIS as a way to use ETL techniques using Microsoft's Hadoop on Windows (HDInsight) as a source using Hive connectors...More
SQL Server Pro Forums

Get answers to questions, share tips, and engage with the SQL Server community in our Forums.