Search code examples
oracle-databasems-accessms-access-2003pass-through

MS Access Expressions in Pass-Through Query to Oracle DB


I am trying to create a Pass-through SQL statement from my MS Access 2003 (Yeah, I know it's oldschool but my hands are tied :/) to an Oracle DB on a Server.

Long story short, the server-table contains freezer models, where each model exists 1 to 5 times with the ID prefixed with a value indicating it's condition. The problem is, that I have to fetch all "versions" of a freezer. In Access I would write something like:

SQL = "SELECT Right(FREEZERS.ID,4) FROM FREEZERS WHERE Right(FREEZERS.ID,4) = '" & myID & "'"

But this triggers an error in my Pass-through query to Oracle. Is it even possible to write expressions like this in a pass-through query?

I am using vba and a QueryDef with a connectstring to the server (which works fine if i strip the Right()-expression), and then open a recordset with the result.

Thanks on beforehand, Viggo

EDIT: Ah, sorry..

Took one last Googling and the Answer popped up:

Apparently Oracle has a different syntax for some of these functions. In this case I found that Oracle has a SUBSTR-function and a LENGTH-function, fixing my problem..

To others in search: The key is searching for Oracle syntax rather than Pass-through syntax..

Source: http://peoplesofttipster.com/2008/08/18/substringing-and-oracle-sql-basic-trick/

Hope it can help someone else :)


Solution

  • As described in the above:

    In Pass-Through queries the SQL language of the server.. :)