Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Update from product
set period='1950-10-01'
where period='2050-10-01'
Update from product
set period=to_date('1950-10-01','yyyy-MM-dd')
where period=to_date('2050-10-01','yyyy-MM-dd')
Update product
set period=to_date('1950'||to_char(period,'MMDDHH24MISS'),'YYYYMMDDHH24MISS')
where to_char(period,'YYYY')='2050'
are you sure about that? Bit of a general swingeing statement there! Since you have no idea how the dates were inserted, you have no idea as to the value of the time component of the dates, you therefore cannot make the assumption that you made. Granted, I also made an assumption that the date values had a truncated time element but I think that this is a far more valid assumption 1. Because of the code already supplied by the OP (using date strings without time elements)Also jimirvine's ... because the time parts will never match
SQL> drop table dat;
Table dropped.
SQL>
SQL> create table dat (id number, dat1 date);
Table created.
SQL>
SQL> insert into dat values(1, to_date('10-Oct-1972','dd-mon-yyyy'));
1 row created.
SQL>--Notice the slightly different format model, watch out for that in the next bit.
SQL> insert into dat values(1, to_date('10-Oct-72','dd-mon-yy'));
1 row created.
SQL>
SQL> insert into dat values(1, trunc(sysdate));
1 row created.
SQL>
SQL> insert into dat values(1, sysdate);
1 row created.
SQL>
SQL> select * from dat;
Page 1
ID DAT1
---------- ---------
1 10-OCT-72
1 10-OCT-72
1 15-JUN-07
1 15-JUN-07
SQL>
SQL> select * from dat where dat1 = to_date('10-oct-1972','dd-mon-yyyy');
Page 1
ID DAT1
---------- ---------
1 10-OCT-72
SQL>
SQL> select * from dat where dat1 = to_date('10-oct-1972','dd-mon-yyyy') or dat1 = trunc(sysdate);
Page 1
ID DAT1
---------- ---------
1 10-OCT-72
1 15-JUN-07
SQL>
SQL> select to_char(dat1,'dd-mon-yyyy hh:mm:ss') dat1 from dat ;
Page 1
DAT1
--------------------
10-oct-1972 12:10:00
10-oct-2072 12:10:00
15-jun-2007 12:06:00
15-jun-2007 12:06:12