Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: update date filed in tables?
yliu wrote
> set thrudate = to_date('31-dec-2099', 'dd-mon-yyyy')
> where thrudate = to_date ('31-dec-99', 'dd-mon-yy') ;
Note that Oracle always stores four digits years. I'd prefer
where thrudate = to_date ('31-dec-1999', 'dd-mon-yyyy') ;
but well, your code would work as well, unless thrudate could also contain a time part. Then use:
set thrudate = to_date('31-dec-2099', 'dd-mon-yyyy') where trunc(thrudate) = to_date ('31-dec-1999', 'dd-mon-yyyy') ;
or if performance is an issue and thrudate has an index (which I doubt as a lot of rows have the value set to 31-dec-1999):
where thrudate between to_date ('31-dec-1999', 'dd-mon-yyyy')
and to_date ('31-dec-1999 23:59:59', 'dd-mon-yyyy hh24:mi:ss');
Arjan. Received on Fri Apr 23 1999 - 10:41:40 CDT
![]() |
![]() |