Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: TO_CHAR PROBLEMS WITH FORMATING DATE INVALID NUMBER
Kev Baker wrote:
> Hi
>
> I wonder if anyone can help
>
> I am trying to format a date using to_char
>
> When I use sysdate to char works no problem.
>
> select to_char(sysdate,'MM/DD/YY') from dual;
>
>
> However when I cut and paste the date from the result of (select
> sysdate from dual) and then put that into the statement below I get an
> 'Invalid Number' error message.
>
> select to_char('18-FEB-2003 09:40:49','MM/DD/YY') from dual;
>
> Any ideas?
>
> Thanks
You have to nest a to_date for your date '18-FEB-2003 ...' and then it
should work.
select to_char(to_date('18-FEB-2003 09:40:49', 'DD-MON-YYYY
HH24:MI:SS'),'MM/DD/YY') from dual;
Axel Received on Tue Feb 18 2003 - 04:23:06 CST