p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > SQL Server > SQL Server 2000 > SQL Server 2000
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 1st, 2004, 12:14 PM
Authorized User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling Oracle Stored Procedure using Linked Serve

I have a linked server to oracle, I will have to call an oracle stored procedure from SQL Server.
Any Ideas on this??

Regards
Twinkle

__________________
Warm Regards From,
Twinkle
************************************************** *******************
I don\'t know the key to success, but the key to failure is trying to please everybody.
************************************************** *******************
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old July 1st, 2004, 12:39 PM
Friend of Wrox
Points: 2,352, Level: 20
Points: 2,352, Level: 20 Points: 2,352, Level: 20 Points: 2,352, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Unlink them.
Create the SP in Oracle.
Call the SP through the ADO.NET driver to Oracle.
the oracle client must be installed (and configured) on the machine you wish to talk to oracle with.

That's all I know- my Oracle DBA actually set it up for me when I needed it.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old July 2nd, 2004, 01:50 AM
Friend of Wrox
Points: 7,647, Level: 37
Points: 7,647, Level: 37 Points: 7,647, Level: 37 Points: 7,647, Level: 37
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,477
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not good at that, just took that from a site on searching for that info. See if that helps.


How do you execute stored procedures in Oracle9i from MS SQL Server 2000? Is it possible?

It is possible, but you have a little bit of work to do. First, you'll probably want to visit SQL Server's documentation. For SQL Server 2000, fire up Books Online and choose the Index tab. In the search box, search for the 'heterogeneous data sources, distributed queries' entry. This will give you all the information, or links to the information, on how to set up SQL Server to access data in a non-SQL server (i.e. Oracle) environment. What this doesn't tell you is how to execute a stored procedure. The easiest way I know how to execute an Oracle stored procedure from SQL Server is to change the stored procedure in Oracle to a function. This is pretty easy to do. Use the same PL/SQL block that defines the stored procedure and create a function that returns TRUE at the very end. You can have the function return other values depending on the success of the stored procedure code. Or, have the function just call the stored procedure and return some value. Once you have it in a function, then you'll just have SQL Server run a distributed query which does the following:
SELECT my_function FROM dual

In running this query, the function will execute the stored procedure's code and the output value will be returned to SQL Server. You may or may not care what this value is. Just performing the above SELECT is enough to execute the code.

Also check this URL, if that helps too.
Linked Severs on MS SQL Part 4, Oracle

Cheers!

_________________________
- Vijay G
Strive for Perfection
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old July 6th, 2004, 05:02 AM
Authorized User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah, we have called the stored procedure as a function, It is working fine now.Thanks Everyone

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old September 23rd, 2009, 05:02 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default call linked oracle procedure

call oracle procedure (function) via linked server and get its result (return value)
Code:
--input parameters p1, p2, p3
declare @SQL nvarchar(1000)
declare @param nvarchar(100)
declare @result varchar(20) -- numbers may cause data type error

-- (...custom actions, i.e. insert to local table)

set @SQL = N'set @result = (select * from openquery(myLinkedServer, ''select OwnerName.Function_Insert(' + cast(@p1 as varchar) + ', ' + cast(@p1 as varchar) + ', ' + cast(@p3 as varchar) + ') from dual''))'
set @param = '@result varchar output'
EXEC sp_executesql @SQL, @param, @result output 

if @result <> '0' goto ERROR

-- (...custom actions)

return 1 -- OK

ERROR:
-- (...custom actions, i.e. delete from local table with(rowlock))
return 0 -- KO
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
calling stored procedure jomet JSP Basics 0 November 23rd, 2007 08:06 AM
calling an oracle procedure from a jsp page jasonteaboy Pro JSP 0 November 20th, 2006 03:06 PM
Calling an Oracle Stored Procedure booksnore2 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 October 1st, 2004 10:35 AM
Calling Oracle Stored Procedures booksnore2 General .NET 0 August 24th, 2004 03:08 PM
CALLING ORACLE SELECT PROCEDURE danielwajnberg Oracle 1 November 20th, 2003 09:36 PM



All times are GMT -4. The time now is 07:48 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc