Saturday, February 25, 2012

Date format

I am trying to convert a number string into a date. I am using:
to_date(settdate,'yyyy/mm/dd') "New date"
in my select statement. I get the error "input value not long enough for date format"
Why do I get the error?
Thanks.You are talking about "number string". Is your variable "settdate" a Julian date ? Can you give us an example value ?

This works for me :

declare
a varchar2(100);
b date;
begin
a := '2450450';
b := to_date(a,'J');
dbms_output.put_line(to_char(b,'DD(MM/YYYY'));
end;
/

SQL>
01/01/1997

SQL>PL/SQL procedure successfully completed.

No comments:

Post a Comment