create table employee
(
employedID number,
employeeName varchar2(30),
deptid number,
salary number
);
Create table department
(
deptid number,
deptname varchar2(30)
);
CREATE OR REPLACE PROCEDURE insertemp
(
PemployedID IN number,
PemployeeName IN varchar,
Pdepid IN number,
Psalary IN number
)
IS
BEGIN
IF Pdepid NOT IN (SELECT * from department.deptid) THEN
INSERT INTO employee VALUES (PemployedID,’PemployeeName’,00,Psalary);
ELSE
INSERT INTO employee VALUES (PemployedID,’PemployeeName’,Pdepid, Psalary);
END IF;
COMMIT;
END;
/
我正在尝试创建一个存储过程,但我对 oracle SQl 语法并不熟悉。如果表部门中没有 Pdepid,那么我想在表员工中插入一条记录,其中 Pdepid 为 00。为此,我使用 IF 语句。我收到此过程的编译错误。