|
|
 |
| Oracle General Oracle database discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Oracle section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

August 23rd, 2005, 08:55 AM
|
|
Registered User
|
|
Join Date: Aug 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
SQL DATE-Format Problem
Hi,
i'm useing two tables:
project.id project.mandant
----------------------------
1 A
2 A
3 B
4 B
attr.id attr.name attr.value
----------------------------
1 DATE 12.01.2005
2 DATE 12.01.2005
3 DATE 12.01.2005 13:45:20
4 DATE 12.01.2005 13:47:20
The following SQL-Statement throw an error (ORA-01830).
select p.project_id, TO_DATE(a.value) AS SDATE
from project p, attr a
where p.mandant = 'A' and a.id = p.id
and a.name = 'DATE'
and TO_DATE(a.value,'DD.MM.YYYY') >= TO_DATE('01.08.2005','DD.MM.YYYY')
How can i make oracle only look at the attr.id = 1 and attr.id = 2 ?
Greeting
Fritz
|

August 26th, 2005, 08:14 AM
|
|
Authorized User
|
|
Join Date: May 2005
Location: Berlin, CT, USA.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by Fritz
Hi,
i'm useing two tables:
project.id project.mandant
----------------------------
1 A
2 A
3 B
4 B
attr.id attr.name attr.value
----------------------------
1 DATE 12.01.2005
2 DATE 12.01.2005
3 DATE 12.01.2005 13:45:20
4 DATE 12.01.2005 13:47:20
The following SQL-Statement throw an error (ORA-01830).
select p.project_id, TO_DATE(a.value) AS SDATE
from project p, attr a
where p.mandant = 'A' and a.id = p.id
and a.name = 'DATE'
and TO_DATE(a.value,'DD.MM.YYYY') >= TO_DATE('01.08.2005','DD.MM.YYYY')
How can i make oracle only look at the attr.id = 1 and attr.id = 2 ?
Greeting
Fritz
|
Hi:
Change the line
Code:
TO_DATE(a.value) AS SDATE
to the following:
Code:
TO_DATE(a.value,'DD.MM.YYYY') AS SDATE
The problem is that the TO_DATE function doesn't recognize the data in your field properly... It needs to know which are the months, days, etc.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |