Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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!
Reply With Quote
  #2 (permalink)  
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

Reply With Quote
  #3 (permalink)  
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!
Reply With Quote
  #4 (permalink)  
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


Reply With Quote
  #5 (permalink)  
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!
Reply With Quote
  #6 (permalink)  
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?

Reply With Quote
  #7 (permalink)  
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..
Reply With Quote
  #8 (permalink)  
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?

Reply With Quote
  #9 (permalink)  
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.
Reply With Quote
  #10 (permalink)  
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 :-)

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:11 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.