Access Oracle SQL

G

Guest

I have an app to access Oracle database from Access mdb file.

It looks that Oracle has it date format.

I have folowing SQL code:

"SELECT * FROM MyTable
WHERE MyField = to_date('07/18/2005', 'mm/dd/yyy')"

It works, I wnated to use date() instaed of hardcode date.

I tried the following:

"SELECT * FROM MyTable
WHERE MyField = to_date(format(now(), "mm/dd/yyy"), 'mm/dd/yyy')"

It does not work.

Are there any way to convert a Oracle date format from date() function in
Access?

Any informaiton is great appreciated,
 
J

John Vinson

"SELECT * FROM MyTable
WHERE MyField = to_date('07/18/2005', 'mm/dd/yyy')"

It works, I wnated to use date() instaed of hardcode date.

I tried the following:

"SELECT * FROM MyTable
WHERE MyField = to_date(format(now(), "mm/dd/yyy"), 'mm/dd/yyy')"

It does not work.

Are there any way to convert a Oracle date format from date() function in
Access?

I think you want to use yyyy rather than yyy in your format. Try

SELECT * From MyTable
WHERE MyField = To_Date(Format(Date(), "mm/dd/yyyy"))

or - possibly -

SELECT * From MyTable
WHERE MyField = "'" & Date() & "'"

John W. Vinson[MVP]
 
G

Guest

I got following errors when I tried your suggest.

SELECT * From MyTable
WHERE MyField = To_Date(Format(Date(), "mm/dd/yyyy"))

ORA-00936 ERROR

SELECT * From MyTable
WHERE MyField = "'" & Date() & "'"

ORA-00933 ERROR
 
J

John Vinson

I got following errors when I tried your suggest.

SELECT * From MyTable
WHERE MyField = To_Date(Format(Date(), "mm/dd/yyyy"))

ORA-00936 ERROR

SELECT * From MyTable
WHERE MyField = "'" & Date() & "'"

ORA-00933 ERROR

I'd suggest you repost, Souris - it's been years since I've used an
Access-Oracle link and I'm not coming up with any good ideas. I don't
have Oracle installed so I cannot help with the Oracle error numbers.

John W. Vinson[MVP]
 
G

Guest

Thanks for helping,




John Vinson said:
I'd suggest you repost, Souris - it's been years since I've used an
Access-Oracle link and I'm not coming up with any good ideas. I don't
have Oracle installed so I cannot help with the Oracle error numbers.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top