The scenario given to me as follows. Create employees with following columns;
·         EmpId
·         EmpName
·         EmpEmail
·         EmpDate
In OLTP I need to enter one record at a time and following validations are to be done at backend;
·         EmpId should have a sequence generator
·         No numeric values allowed in EmpName
·         EmpDate should be in format mm/dd/yyyy
·         Email Id should have following validations
o   Should contain ‘@’ sign and it should be only one
o   Should end with ‘.com’
o   Email id should have more than 3 characters
for this i've created a table and sequence like this
create table emp_316599
  (EmpId number(6),
  EmpName varchar2(15)CONSTRAINT chk_EmpName 
     check(regexp_like(EmpName,'![0-9]+')),
  EmpEmail varchar2(15) CONSTRAINT chk_EmpEmail
    check((length(EmpEmail)>3) and
      substr(EmpEmail,-4)='.com' and
            instr(EmpEmail,'@',1,2)=0),
  EmpDate varchar2(15) 
  CONSTRAINT chek_EmpDate
    check(EmpDate=to_char(EmpDate,'mm-dd-yyyy')));
  Table created.       
 create sequence Emp_SEQ
 increment by 1
 start with 1
 maxvalue 1000
 cache 20
sequence created.
Here comes the problem. When i am trying to insert using the below command it is giving me the error.
insert into emp_316599 values(Emp_SEQ.NEXTVAL,'&EmpName','&EmpEmail','&EmpDate');
ORA-01722 invalid number
Please help me out.
Work environment as follows DB:Oracle 11g, tool:plsql developer
Thanks Kumar
 
    