I have a table in DB from which I take values from a date field.I store this date value in a cursor. currently the date value is of the format DD:MON:YY. Now I convert this date into character using to_char function so as to append time 00:00:00 to it. now I tried converting back to the date format , but the timestamp is not appended and the date format is not as I have given( format is same as that of the date field in DB).but the to_char function returns the correct format as I have given.
Some of the code snippets are as follows:
Initialized a cursor as
cursor cur is
select to_char(STV_FROM_DATE,'DD:MON:YYYY:')STV_FROM_DATE :---from a table in DB
cur1 cur%rowtype;
begin
open cur;
loop
fetch cur into cur1;
dbms_output.put_line(cur_1.STV_FROM_DATE);
This is giving the value correctly as:
01:JAN:2000:
01:JAN:2000:
01:JAN:2000:
01:JAN:2000:
Now I appended the timestamp 00:00:00 to this and did the to_date operation as follows:
STV_FROM_DATE_BC := cur_1.STV_FROM_DATE;
STV_FROM_DATEBCKUP:=to_date(STV_FROM_DATE_BC,'DD:MM:YY:HH24:MI:SS');
dbms_output.put_line(STV_FROM_DATEBCKUP);
The result obtained is:
01-JAN-00
01-JAN-00
01-JAN-00
Could anyone help me to solve this issue and convert the timestamp appended character to date?