Here's the table schema:
create table EMPLOYEE
(fname /* Employee's first name */ varchar(15) not null,
init /* Employee's middle initial */ char(1),
lname /* Employee's last name */ varchar(15) not null,
IRD /* Employee's IRD number */ varchar(10) not null primary key, sex /* Employee's sex */ char(1)
constraint check_sex check (sex in ('f','m','F','M')),
bdate /* Employee's birthdate */ date,
office /* Employee's office */ varchar(5),
reg_org /* The number of the registration office the employee works for */
varchar(10),
sdate /* Starting date in the organization */ date);
Then I think it make sense to add the constraint
alter table employee
add constraint ck_date check (sdate >= bate);
but it gives me an error
add constraint ck_date check (sdate >= bdate)
*
ERROR at line 2:
ORA-02293: cannot validate (SYSTEM.CK_DATE) - check constraint violated
Anyone know where I go wrong?
update the data of the two columns
SQL> select bdate, sdate from employee;
BDATE SDATE
--------- ---------
21-JAN-58 22-FEB-10
21-MAY-70 17-MAR-09
09-NOV-47 12-MAY-08
10-OCT-53 15-JUN-09
01-OCT-56 01-OCT-05
SQL> select to_char(bdate, 'yyyy-mm-dd') as bdate, to_char(sdate,'yyyy-mm-dd') from employee;
BDATE TO_CHAR(SD
---------- ----------
1958-01-21 2010-02-22
1970-05-21 2009-03-17
2047-11-09 2008-05-12
1953-10-10 2009-06-15
1956-10-01 2005-10-01