472,805 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

add hint in access query

Hi,
I'm using MS Access to query against Oracle DB via ODBC. Is it
possible to use HINT in Access?

Thanks,

Wei

Oct 2 '06 #1
12 4980
If you make the query pass-though..then, you can use the raw oracle syntax,
and that would include using hint syntax in the sql...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Oct 2 '06 #2
Albert,
Thanks for your reply.
If I use pass-through query, how can I convert access sql to raw
oracle sql? Do I have to do it manually, or access can do it for me?
Can I query across DB schema, which is to query against tables in
different schema? In access, we use "link table" to bring tables from
different schema together. How can I do it in raw oracle sql?

Thanks again,

Wei

Albert D. Kallal wrote:
If you make the query pass-though..then, you can use the raw oracle syntax,
and that would include using hint syntax in the sql...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Oct 2 '06 #3
When you create a query in MS Access, it has to be in the Access
version of SQL. When you create a pass-through query, you do not get
the QBE grid, but rather, just a screen ready for you to type in your
SQL. Access doesn't look at it, but just submits it to Oracle to
process. You can use whatever SQL you would like. Oracle will then
give back the records that meet that criteria.
Chris Nebinger
zw****@gmail.com wrote:
Albert,
Thanks for your reply.
If I use pass-through query, how can I convert access sql to raw
oracle sql? Do I have to do it manually, or access can do it for me?
Can I query across DB schema, which is to query against tables in
different schema? In access, we use "link table" to bring tables from
different schema together. How can I do it in raw oracle sql?

Thanks again,

Wei

Albert D. Kallal wrote:
If you make the query pass-though..then, you can use the raw oracle syntax,
and that would include using hint syntax in the sql...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Oct 2 '06 #4
Right. But as far as I know, in Oracle we can't query tables from
multiple schema, where they can't see each other (For example, schema A
doesn't have access to table T in schema B). In Access, we can do it
through linked tables, but I can't control the query plan.

What I want is capability of both. Is it possible?

Thanks,

Wei

Oct 2 '06 #5
Lord, you can, but I wouldn't want to. you would leave it to Access to
join the tables, which would be horrendous.

I would rather pull the appropriate data from table a, put it in a temp
table, then modify the pass-through SQL on table b to only pull the
records that would be joined, then add it to a second table in Access.
Then, use a native query to display these. This is a horrible
solution, however.

Chris Nebinger
zw****@gmail.com wrote:
Right. But as far as I know, in Oracle we can't query tables from
multiple schema, where they can't see each other (For example, schema A
doesn't have access to table T in schema B). In Access, we can do it
through linked tables, but I can't control the query plan.

What I want is capability of both. Is it possible?

Thanks,

Wei
Oct 2 '06 #6
zw****@gmail.com wrote:
If I use pass-through query, how can I convert access sql to raw
oracle sql? Do I have to do it manually, or access can do it for me?
Can I query across DB schema, which is to query against tables in
different schema? In access, we use "link table" to bring tables from
different schema together. How can I do it in raw oracle sql?
By using different connect strings for the ptq.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Oct 3 '06 #7
Tim,
Would it be ok to show me how to use different connect strings in the
ptq?
For example, I have table T1 in schema A, and table T2 in schema B.
schema A can't access T2, and schema B can't access T1. c1 and c2 are
columns in T1 and T2.
How do I write the following query as a ptq?

select T1.*
from T1, T2
where T1.c1=T2.c2

If I login A, then B.T2 does not work in above query.
The connect strings are: u1/p1@A and u2/p2@B

Thannks a lot!

Wei

Oct 3 '06 #8
zw****@gmail.com wrote:
Tim,
Would it be ok to show me how to use different connect strings in the
ptq?
For example, I have table T1 in schema A, and table T2 in schema B.
schema A can't access T2, and schema B can't access T1. c1 and c2 are
columns in T1 and T2.
How do I write the following query as a ptq?

select T1.*
from T1, T2
where T1.c1=T2.c2

If I login A, then B.T2 does not work in above query.
The connect strings are: u1/p1@A and u2/p2@B
Wei, to the best of my knowledge, you'd need to use a combination of MS
Access's native Jet engine and the pass through queries.

I use ODBC connections to access Oracle tables. To do this, I'd have to
set up two separate DSNs, one for schema A, the other for schema B.

Create two pass through queries, first. If you're not sure how to do
this, simply click on the new button in the query tab/view in the MS
Access database window and choose design view. With the query design
grid that opens, a pop up window entitled "Show Table" appears. Close
the pop up without choosing anything and on the Query menu select SQL
SPecific -Pass-Through. A blank SQL window now appears.

Write your statement, say:

SELECT *
FROM T1

Then, press alt-enter to open the Access properties window for this
query. The second text box should read "ODBC Connect Str". Click the
builder button and select the T1Dsn. Save the pass-thorugh query as
something convenient, I'd use ptqT1

Repeat for T2, using T2Dsn and save as something like ptqT2.

Now you have two objects saved in your MS Access query tab/view. What
you can do now, is construct a third query in the MS Access query
tab/view that is not Oracle SQL, but actually Jet SQL. In SQL it would
look something like:

Select T1.*
From T1 INNER JOIN T2 ON T1.c1 = T2.c2

And now you've got the two schema holding hands together, hurrah! 8)

There may well be a better way to do this in Oracle SQL only, but I'm
not versed well enough in Oraclese to know how to do it.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Oct 3 '06 #9
Tim Marshall wrote:
Create two pass through queries, first. If you're not sure how to do
this, simply click on the new button in the query tab/view in the MS
Access database window and choose design view. With the query design
grid that opens, a pop up window entitled "Show Table" appears. Close
the pop up without choosing anything and on the Query menu select SQL
SPecific -Pass-Through. A blank SQL window now appears.

Write your statement, say:

SELECT *
FROM T1
Wei, not sure how clear I was on this, but the SQL written in any
pass-through query would be the Oracle dialect you are used to working
with. Not Jet dialect (Jet being the engine packaged with MS Access).

I always work with Oracle tables from the same schema (possibly
different user names, but always the same schema). I prefer PTQ as
opposed to using linked Oracle tables because:

1) Joins are oh so much easier to write code for if you are writing VBA
to create dynamic SQL (by "dynamic", I mean SQL that is constructed in
response to choices made by the user on MS Access forms);

2) The linked table method absolutely dies when you are using a lot of
sub-queries of any type, at least with my data, anyway; and

3) Performance really slows when more than 5 or 6 tables are joined and
sometimes, especially when you have only some or even no control over
the Oracle data structure to modify or create indexes, the MS Access
linked table queries breakdown and don't perform properly altogether.

I find MS Access to be an absolutely wonderful tool for Oracle
administration and even better for application development.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Oct 3 '06 #10
If I use pass-through query, how can I convert access sql to raw
oracle sql?
Unless oracle has some ability to do this, no, you can't You can even send
oracle execute commands with a pass through.
pass-through means msaccess/jet does not touch the sql...it is all 100%
oracle....
Can I query across DB schema, which is to query against tables in
different schema? In access, we use "link table" to bring tables from
different schema together. How can I do it in raw oracle sql?
I am not sure I understand the above question? You moved the data to oracle
(or it was there in the first place). You are now running some quires built
in ms-access against that data? (what does copying the db schema have to do
with this?) I mean, sure, there is some oracle tools to import the data if
that is what you are asking??? What import options, and what options oracle
has to import ms-access data, and the db schema is going to be that of
oracle. I not aware that is it common that MySql, Sybase, Sql-server, or
ms-access are in the business of making tools to transfer their data to
oracle. Quite sure this is going to be a oracle question...check in their
news groups....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Oct 5 '06 #11
Albert,
I'm not talking about transfering data to Oracle. The Data were in
Oracle, and I just use MS/Access to access them via ODBC.
I want to link tables in two Oracle databases with MS/Access (through
linked table) and still be able to use Oracle hints. Is it possible?

Thanks,

Wei

Albert D. Kallal wrote:
If I use pass-through query, how can I convert access sql to raw
oracle sql?

Unless oracle has some ability to do this, no, you can't You can even send
oracle execute commands with a pass through.
pass-through means msaccess/jet does not touch the sql...it is all 100%
oracle....
Can I query across DB schema, which is to query against tables in
different schema? In access, we use "link table" to bring tables from
different schema together. How can I do it in raw oracle sql?

I am not sure I understand the above question? You moved the data to oracle
(or it was there in the first place). You are now running some quires built
in ms-access against that data? (what does copying the db schema have to do
with this?) I mean, sure, there is some oracle tools to import the data if
that is what you are asking??? What import options, and what options oracle
has to import ms-access data, and the db schema is going to be that of
oracle. I not aware that is it common that MySql, Sybase, Sql-server, or
ms-access are in the business of making tools to transfer their data to
oracle. Quite sure this is going to be a oracle question...check in their
news groups....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Oct 6 '06 #12
zw****@gmail.com wrote:
Albert,
I'm not talking about transfering data to Oracle. The Data were in
Oracle, and I just use MS/Access to access them via ODBC.
I want to link tables in two Oracle databases with MS/Access (through
linked table) and still be able to use Oracle hints. Is it possible?
Although I dealt with PTQs, I think if you'd try my solution, you'd see
that it is quite possible.

Create the DSNs and then link the tables, instead of creating the PTQs
as I described. Once you do it, you'll see it's really a no brainer.

8)
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Oct 6 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: john smile | last post by:
Hi All, I want to lock 2 tables on 2 servers using TABLOCKX hint. These tables function as semaphores in my application. It means when the tables are locked then other users will not be able to...
2
by: Stephen McMahon | last post by:
Background: I am currently working on a mission critical web based application that is accessed 24 hours a day by users from just about every time zone. We use MS SQL Server as our database and...
1
by: Mark P | last post by:
Is an insert with hint (in say std::set) only beneficial if the insertion occurs immediately before the pointed to location of the hint? Suppose the insertion occurs right after the hint location? ...
6
by: Mark P | last post by:
Some time ago I posted here about inserting into a set with a hint: ...
7
by: piperzen | last post by:
Hi, I'm developing a set of language learning exercises for http://www.yale.edu/swahili , and we've run into a javascript question that the programmer doesn't know how to tackle (we mostly work...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
7
by: alexander324 | last post by:
I have an access table that has around 4000 records showing various carrier names, origin and destination city, state and zip along distance and cost etc. Is there a way to automate a process that...
3
by: suneelchetty | last post by:
I am firing a query which uses a table hint /*+ USE_CONCAT */ on a table which 250 million data with 13 indexes on it. The problem is query is taking a lot of time to execute i.e. more than 3...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.