5.0.51b-community.
I created a table like this :
CREATE TABLE `cbse`.`employee` (
`ecode` INT NOT NULL ,
`ecode1` INT NOT NULL,
`ename` VARCHAR( 20 ) NOT NULL ,
`sex` VARCHAR( 1 ) NOT NULL ,
`grade` VARCHAR( 2 ) NOT NULL ,
`gross` DECIMAL NOT NULL,
CHECK (`ecode`<`ecode1`)
)
and the strict mode is on :
SET @@global.sql_mode= 'STRICT_TRANS_TABLES';
still I am able to insert a row with ecode = 20 and ecode1 = 10 .
How?
Ans :
>>Is there any alternative for the CHECK clause then?
Alternative... use triggers for this.... before insert you can check whether values are proper..
>>And does this clause work for Oracle db? Since
I saw it in a book which is supposedly written
keeping Oracle in mind.
It works for Oracle... Oracle enforces this constraints strictly.
Alternative... use triggers for this.... before insert you can check whether values are proper..
>>And does this clause work for Oracle db? Since
I saw it in a book which is supposedly written
keeping Oracle in mind.
It works for Oracle... Oracle enforces this constraints strictly.
No comments:
Post a Comment