Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: to_date format
mattjones_at_hotmail.co.uk schreef:
> Hi
> Im trying to convert part of a string into a date. So far i have:
> $dbh->do ("INSERT INTO TEST4 (log_name) VALUES (TO_DATE('$filename',
> 'YYYYMMDDHH24'))");
>
> where:
> $filename = 2006090603_103_fs.log
>
> i need the 2006090603 to be changed into a date and placed itno a field
> but i also need the '103' placed into a seperate field.
>
> The above statement is giveing me the error :
> RA-01830: date format picture ends before converting entire input
> string
>
> I think its because i am telling it what to do with the '2006090603'
> part of the name but then it doesn't know what to do with
> '_103_fs.log'. Is there a format so the sql omit's this last bit of
> information?
>
> Any thoughts on this?
"2006090603_103_fs.log" is NOT a date! And that is the error you get. "20060906" would be a date, using the format 'YYYYMMDD'. "2006090603" could be a data, don't know. Format mask would be'YYYYMMDDHH', if the 03 stands for 3 'o clock. Split your data, and offer it in seperate values. Received on Tue Sep 19 2006 - 06:05:43 CDT
![]() |
![]() |