Today, I would like to experiment the use of CHECK constraint to
validate the trailing blanks in the data.
Example,
demo$Vino%orcl> create table t(name varchar2(20) 2 check (length(name)-length(trim(name))=0));Hope this will be useful for you :-)
Table created.
demo$Vino%orcl> insert into t values('Tom'); 1 row created.
demo$Vino%orcl> insert into t values('Tom Peter'); 1 row created.
demo$Vino%orcl> -- Name with trailing blanks
demo$Vino%orcl> insert into t values('Tom '); insert into t values('Tom ') * ERROR at line 1: ORA-02290: check constraint (DEMO.SYS_C005409) violated
demo$Vino%orcl> select * from t;
NAME ---------- Tom Tom Peter
No comments:
Post a Comment