Create trigger on the table Employees, which should:
Trigger on the data insertion command
Format the phone
field, converting it to the pattern (YYY)XXX-XX-XX
. The number you enter must be 10 digits. The trigger should check for this. If the number has less than or more than 10 digits, then prohibit data insertion and issue an error message.
Tables:
CREATE TABLE dept
(
dept_id number(3) not null,
dept_name varchar2(50) not null,
emp_cnt number(3) not null,
constraint dept_pk primary key (dept_id)
);
/
CREATE TABLE employees
(
emp_id number(3) not null,
dept_id number(3) not null,
emp_name varchar2(50) not null,
address varchar2(100),
phone varchar2(20) not null,
salary number(8,2) not null,
constraint emp_pk primary key (emp_id),
constraint dept_fk foreign key (dept_id) references dept(dept_id)
);
/
Please, help me
varchar2
and the slash after the statement – Barbaros Özhan