Hello Guys
Actually my column contains date in following format
dd/mm/yyyy
I am trying this query to update it into
something like
dd/mm/yyyy HH24:MM:SI
when i am using SELECT statment it worked fine but when i update the column it's
saying not a valid month
Please look at the querys
select to_Char(to_date(create_date, 'mm/dd/yy HH24:MI:SS' ), ...
Hi,
Apparantly you have some bad data.
See this thread for help in finding it.
I load_date a string also?
If so, you should use TO_DATE in the WHERE clause, also.
Dates belong in DATE columns. Once you find and correct (or remove) all the bad data, you should add a DATE column (or two, depending on load_date) and remove the old VARCHAR2 column(s...
If create_date is already in mm/dd/yyyy format (as you're writing) the update is changing to value to itself...
SVIL>select to_Char(to_date( '09/16/2009' , 'mm/dd/yy HH24:MI:SS' ), 'mm/dd/yyyy' )
2 from dual;
TO_CHAR(TO
----------
09/16/2009
Max
user10647455 wrote:
Hello Guys
Actually my column contains date in following format
dd/mm/yyyy
Please look at the querys
select to_Char(to_date(create_date, 'mm/dd/yy HH24:MI:SS' ), 'mm/dd/yyyy HH24:MI:SS' )
from Report
where trunc(Load_Date) = trunc(sysdate - 52)
--WorkingFine
--but this one not its getting updated no issue in update ...
thanks for replies guys
but i have data in column in various formates
some has timestap like including HH24MISS
and some has only mm/dd/yyyy
so tats y i need to convert
so wat could be possible way to do that
please suggest
and yea you guys true i have bad data in table but need to convert into date by anyhow
soo please help
in case of when i have ...
Hi,
Centinul wrote:
Frank --
I can't view the link you posted. I think it has an extra "?" at the end.
Thanks for pointing that out; it's fixed now.
This site sometimes strips off the last number from the URL, the part that iedentifies the exact message within the thread.
When that happens, you can always remove the non-digits from the end of ...
I am just wondering, what is the datatype of create_date? I suspect you are trying to convert a date field into a character and then use that to update a date field - which will do an implicit conversion and fail because the date format you have does not match with the default nls_date_format.
that is the only reason I can see how the following will work:...
If you want this format (mm/dd/yyyy HH24.MI:SS) after updating the table, your update must be:
Update Report
Set Create_date = to_Char(to_date(Create_date, 'mm/dd/yy HH24:MI:SS' ), 'mm/dd/yyyy hh24:mi:ss' )
where trunc(Load_Date) = trunc(sysdate - 52)
Max
Frank Kulash wrote:
This site sometimes strips off the last number from the URL, the part that iedentifies the exact message within the thread.
When that happens, you can always remove the non-digits from the end of the URL, as Boneist did, and read the whole thread.
Frank --
Thanks. I understand and that's what I did.
I just wanted to point ...
If you want this format (mm/dd/yyyy HH24.MI:SS) after updating the table, your update must be: Update Report Set Create_date = to_Char(to_date(Create_date, 'mm/dd/yy HH24:MI:SS' ), 'mm/dd/yyyy hh24:mi:ss' ) where trunc(Load_Date) = trunc(sysdate - 52) Max
Hi, Centinul wrote: Frank -- I can't view the link you posted. I think it has an extra "?" at the end. Thanks for pointing that out; it's fixed now. This site sometimes strips off the last number from the URL, the part that iedentifies the exact message within the thread. When that happens, you can always remove the non-digits from the end of the URL, as Boneist did, and read the whole thread.
Frank Kulash wrote: This site sometimes strips off the last number from the URL, the part that iedentifies the exact message within the thread. When that happens, you can always remove the non-digits from the end of the URL, as Boneist did, and read the whole thread. Frank -- Thanks. I understand and that's what I did. I just wanted to point it out to those folks that didn't know that didn't get confused.
I am just wondering, what is the datatype of create_date? I suspect you are trying to convert a date field into a character and then use that to update a date field - which will do an implicit conversion and fail because the date format you have does not match with the default nls_date_format. that is the only reason I can see how the following will work: select to_Char(to_date(create_date, 'mm/dd/yy HH24:MI:SS' ), 'mm/dd/yyyy...
Thread profile page for "Converting Varchar2 to Date getting prob" on http://www.oracle.com.
This report page is a snippet summary view from a single thread "Converting Varchar2 to Date getting prob", located on the Message Board at http://www.oracle.com.
This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity