Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access 2003: any easy way to use stored Oracle functions as part of regular Access SELECT query?

Posted on 2008-10-03
10
Medium Priority
?
232 Views
Last Modified: 2013-11-27
We are supporting a Microsoft Access application that accesses Oracle data through ODBC Linked Tables. Access Select queries are used to select data from the linked Oracle tables for use in reports. Changes in the underlying Oracle database have resulted in the requirement to use an custom Oracle function to return a value that used to be available as a column.

Attempts to call the Oracle function in the SELECT clause of the Access Select query SQL statement resulted in errors. In an attempt to work around this, we converted the Access Select query to a SQL Pass-through query and the Oracle function can be called successfully.

Is a SQL Pass-through query the only way to call a stored Oracle function as part of a SELECT clause, or is this also possible in a regular Access Select query?
0
Comment
Question by:huangs3
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 200 total points
ID: 22638154
If you're using the CurrentProject.Connection then I believe it is ... you could try building your own connection to the database and use that, but even then I believe you'll run into issues.

To me, a better solution would be to build a Stored Proc on the server that handled this for you and simply returned a formatted/filtered recordset to you. Build it such that is will accept input parameters for filters and such, and let the server deal with it.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 22638262
The only way to use a stored Oracle function in a remote database from Access is via a SQL Pass-Through query..
0
 
LVL 7

Assisted Solution

by:rheitzman
rheitzman earned 1100 total points
ID: 22638270
From the Access side the Pass-Through query is the primary method. You can develop your query and then in the last pass add the Oracle Function and turn it into a pass though. You might experience date comparison problems however.

You should be able to use an Oracle View and link to as you would a table.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 44

Expert Comment

by:GRayL
ID: 22638317
But Linking has all the overhead of delivering all the data to Access and then Access has to determine the answer.  A pass through only delivers the answer.  
0
 

Author Comment

by:huangs3
ID: 22668705
We encounter an issue of using Pass-through. There is one Access query using the form parameters (like [Forms]![InputForm]![begin-Date] ) in its where-clause, and needs to call the database function at the same time.

I couldn't find a way to let a pass-through function use the form parameter, what is the best way for me to handle this in Access?
0
 
LVL 44

Accepted Solution

by:
GRayL earned 700 total points
ID: 22670139
And now Oracle does not have any exposure to the Access mdb which sent the Pass-Through query.  I don't know if you can use any Access functions like Date() in a Pass-Through.  If you can, then maybe by creating a function which obtains the value from the open form might be a solution.  With a form frmDate open with a textbox named tbxDateset (Format property set to short date) in which you have entered =Date()

eg.  Instead of Date() in the Pass-through use GetDate()

Public Function GetDate() AS Date
  GetDate = Forms!frmDate!tbxDate
End Function

It all depends on whether Access will process the function before passing the query.  That failing, it is probably possible to create a pass-through in VBA and use code to send it -  just trying to think outside the box.
0
 
LVL 7

Assisted Solution

by:rheitzman
rheitzman earned 1100 total points
ID: 22674414
I think if you use an Oracle view to resolve the Oracle function problem the view can be linked to from Access. The Access side link would support Access functions and references to any other objects Access can utilize with a local table.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 22674463
If an Oracle View can utilize Oracle functions to reduce the size of the dataset sent to Access and Access in turn can utilize its objects to further reduce the dataset to match all the remaining criteria, then you have a solution - probably saying the same thing ;-)
0
 

Author Comment

by:huangs3
ID: 22768410
Thank you for everybody's idea, we end up with using a database View to call the database function, and the issue solved.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 22768498
Thanks, glad to help
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question