
CREATE OR REPLACE PROCEDURE insert_emp
(p_emp_id IN f_emps.employee_id%TYPE,
p_last_name IN f_emps.last_name%TYPE,
p_salary IN f_emps.salary%TYPE,
p_department_id IN f_emps.department_id%TYPE)
IS
v_dept_exists BOOLEAN;
BEGIN
v_dept_exists := check_dept(p_department_id);
IF NOT v_dept_exists THEN
INSERT INTO f_depts(department_id, department_name)
VALUES( p_department_id, 'Temporary');
ELSE
INSERT INTO f_emps(employee_id, last_name, salary, department_id)
VALUES(p_emp_id, p_last_name, p_salary, p_department_id);
END IF;
END insert_emp;
BEGIN
insert_emp(800, 'Jokinen', 5000, 750);
END;

