Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2004, 10:09 AM
Authorized User
 
Join Date: Jan 2004
Location: Frederick, MD, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Running oracle stored procedure from access

Does anyone know how to link to a stored procedure in Oracle from Acess and run it? I've seen it work with SQL Server but I'm having a tough time doing it with Oracle.

I think the syntax for sql server is just

execute procedure_name;

But I still haven't figured out how to link to a procedure using a query.

Any ideas/help would be great. Thanks!
 
Old June 4th, 2004, 10:23 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Justine,

Try using "Pass through Query" in MS Access. That will allow you to execute stored procedures in Oracle.

Cheers,
Prat

 
Old June 4th, 2004, 10:51 AM
Authorized User
 
Join Date: Jan 2004
Location: Frederick, MD, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well you're very helpful today! Thank you. I have my pass-through query all set up, but I'm getting an invalid sql statement error. I've tried both of the following statements. I can't get it to work in oracle either so I know it's wrong. I just don't know how to fix it.

EXECUTE sp_r2_refresh_project_issue;

Call sp_r2_refresh_project_issue;

Thanks again!
 
Old June 4th, 2004, 11:11 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Justine,

In the Access database:

1. Select your pass through query
2. Click on the "Design" button to the right
3. Add the following in the SQL View:
    begin
        sp_r2_refresh_project_issue;
    end;
4. Save it and execute the pass through query

Cheers,
Prat


 
Old June 4th, 2004, 12:08 PM
Authorized User
 
Join Date: Jan 2004
Location: Frederick, MD, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Works great, thank you so much!
 
Old December 21st, 2006, 08:07 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and what about stored procedure with parameter? how can i pass that paramenter to SP?

 
Old December 21st, 2006, 08:44 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Salisbury, Wiltshire, United Kingdom.
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Food for thought, there may be a better established method...

Build a pass-through query as above and add a piece of generic text which you use as your parameter... ie:

sp_r2_refresh_project_issue <<parameter1>>

Then using vba, change the querydef, on the fly, to edit the <<parameter1>>. Are you expecting an action or a result to be returned by your sp? If only an action, you could maybe think about a sub that will do this, for a result set... not entirely sure if there is an improvement to be made??

Let me know how you get on..
 
Old December 21st, 2006, 09:15 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am expecting just an action. unfortunatelly, i cant touch oracle db. i was just given SP and i have to deal with it.
by the way how can i change <<paramater1>> on fly?

 
Old December 21st, 2006, 09:23 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Salisbury, Wiltshire, United Kingdom.
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Try something like:

=============================================
Public Function pfSendORACLE(strParameter As String) As Boolean
Dim qdf As QueryDef

Set qdf = CurrentDb.QueryDefs("qryYourQuery")
qdf.SQL = "Your ORACLE text " & strParameter 'depends how your query is built, but if like SQL they tend to go at the end!
qdf.Execute

pfSendORACLE = True

End Function
=============================================

You may want to put some error handling in to handle timeouts, missed connections etc... but so long as your original query is set up ok, then a change to a pass-through query like this should be no worries. The error handling would return false if the query did not execute... you would need to program this, otherwise change it to a sub and remove the pfSendORACLE = true line!

Hope it helps.
 
Old December 21st, 2006, 09:36 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanx a lot, i used your idea, and it seems to be working now. thanx a lot :-)





Similar Threads
Thread Thread Starter Forum Replies Last Post
running scrolling text from stored procedure in VS cJeffreywang ASP.NET 2.0 Basics 1 August 14th, 2007 03:47 PM
Running stored procedure from .adp module mantle51 Access VBA 1 August 13th, 2007 12:17 PM
Error When Running Stored Procedure Dwizz SQL Server 2000 4 May 15th, 2007 09:07 AM
Running stored procedure in Access VBA Bryon Burbage Access VBA 0 July 21st, 2006 09:14 AM
ASP Code running Stored Procedure kapi.goel ASP.NET 1.0 and 1.1 Basics 0 May 17th, 2006 12:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.