Thank you but i want to make a procedure that make this case and to put it into package and call it from a trigger, so i want to make an anonymous block to do what i need the convert it to a procedure.
Sorry I dont understand what you're asking here
In your answer i can’t find that how to pass the department_id to the employee
My mistake. Line 14 could be recoded as:
insert into emp
values (emp_seq.nextval,
:new.ename,
:new.sal,
( select deptno from dept where dname = :new.dname)
);
where emp has had deptno added as a column.
and a similar alteration for the updating clause
and that with every insert in emp_temp the department name will go to the department table althougth it exist there but this time with a new sequence number ?? In the condition you write where not exists(select null from dept where dname=:new.dname) ?We will only insert a new dept if one with that name does not yet already exist.