-
SQL Problem Urgent
Hi.
Any one let me know why this is happening.
My SQL
Select to_date('01-SEP-2004','YYYY/MM/DD HH24:MI:SS') from dual
Output:
9/20/0001 4:00:00 AM
Its suppose to be 2004/09/01
We are using Oracle 8i 8.1.7
Thanks
-
Look at what you coded. You said:
YYYY = 01
MM = SEP
DD HH24 = 2004
http://download-west.oracle.com/docs...a85397/toc.htm
I suspect you need to_char(to_date(.......)) - I'll leave the details for you to fill in: good learning excerise
Last edited by DaPi; 09-23-2004 at 08:32 AM.
-
Hi dapi.
I already did that. but i need to pass as date not char.
-
'01-SEP-2004' is a character string
Does this help your thought process?
Code:
Select to_char(SYSDATE, 'YYYY/MM/DD HH24:MI:SS') from dual
TO_CHAR(SYSDATE,'YY
-------------------
2004/09/23 14:46:35
Last edited by DaPi; 09-23-2004 at 08:47 AM.
-
Hi dapi.
No, I need to send date, not char.
Thanks
-
Re: SQL Problem Urgent
Originally posted by ba1234
Hi.
Any one let me know why this is happening.
My SQL
Select to_date('01-SEP-2004','YYYY/MM/DD HH24:MI:SS') from dual
Output:
9/20/0001 4:00:00 AM
Its suppose to be 2004/09/01
We are using Oracle 8i 8.1.7
Thanks
Well the date format picture in the To_Date() function is supposed to match the format that you have used to write the date as in the string.
-
Re: SQL Problem Urgent
If you want a DATE as output, why did you confuse the issue by posting two different char representations of it?
Originally posted by ba1234
Output:
9/20/0001 4:00:00 AM
Its suppose to be 2004/09/01
-
Hi,
As DaPi and Slimadave already said, the problem is that your date format is wrong.
You are using:
to_date('01-SEP-2004','YYYY/MM/DD HH24:MI:SS')
But it should be:
to_date('01-SEP-2004','DD-MON-YYYY')
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|