Need help with to_date() function, thanks! [message #36225] |
Mon, 12 November 2001 07:33  |
Newbie
Messages: 19 Registered: November 2001
|
Junior Member |
|
|
Hi, I have a question about to_date(),
right now I have a table with a column defined as VARCHAR2, and I created another table in Oracle,
everything else is the same, except VARCHAR2 column is now defined as DATE type.
I am now trying to transfer the data from one table to the other, and change the VARCHAR2 type to DATE type, how do I use to_date() to do this? I tried to put to_date() inside the fetch loop, but Oracle gives me error, saying it can't be used that way. Help!
Thanks!
----------------------------------------------------------------------
|
|
|
Re: Need help with to_date() function, thanks! [message #36228 is a reply to message #36225] |
Mon, 12 November 2001 09:07  |
hello
Messages: 17 Registered: November 2001
|
Junior Member |
|
|
Hi,
U cannot use to_date function in a fetch statement but instead
u can use it in the cursor declaration.
Cursor c1 is
select name,
phone,
to_date(start_date,'DD-MON-YYYY')
from emp;
where the format(for example 'DD-MON-YYYY') should be the same as the value of start_date
for example if start_date value is 01-NOV-2001 then format of to_date is 'DD-MON-YYYY'
if it is '11/01/01' then format is 'MM/DD/YY' etc.
hope this solves the problem.
----------------------------------------------------------------------
|
|
|