 |
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
|
|
|

June 4th, 2004, 10:09 AM
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|

June 4th, 2004, 10:23 AM
|
Authorized User
|
|
Join Date: Jul 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Justine,
Try using "Pass through Query" in MS Access. That will allow you to execute stored procedures in Oracle.
Cheers,
Prat
|

June 4th, 2004, 10:51 AM
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|

June 4th, 2004, 11:11 AM
|
Authorized User
|
|
Join Date: Jul 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

June 4th, 2004, 12:08 PM
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Works great, thank you so much!
|

December 21st, 2006, 08:07 AM
|
Registered User
|
|
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
and what about stored procedure with parameter? how can i pass that paramenter to SP?
|

December 21st, 2006, 08:44 AM
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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..
|

December 21st, 2006, 09:15 AM
|
Registered User
|
|
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|

December 21st, 2006, 09:23 AM
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

December 21st, 2006, 09:36 AM
|
Registered User
|
|
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanx a lot, i used your idea, and it seems to be working now. thanx a lot :-)
|
|
 |