Create a PL/SQL block to insert a new record into department table.Fetch the maximum department id from the Department table and add 10 to ut,take this value for department id; TESTING is the value for department name and CHN-102 is the value for location ID.
Answers
Answered by
1
Answer:
Hope this is helpful
Explanation:
Please mark me as brainlist
Attachments:
Answered by
1
Answer:
create or replace procedure p_ins_dept (par_dname in varchar2, par_loc in varchar2) is
l_deptno number;
begin
select max(deptno)
into l_deptno
from dept;
insert into dept (deptno, dname, loc)
values (nvl(l_deptno, 0) + 10, par_dname, par_loc);
end;
Explanation:
Keep in mind that a multi-user environment is where such a strategy is most likely to fail.
- When two (or more) users use the process at once.
- it fetches the MAX department number value
- adds 10 to it.
- Insert a row, however the second (and subsequent) users are unable to do so since the main key was violated by the first user, who successfully entered the row..
#SPJ3
Similar questions
Chemistry,
22 days ago
English,
22 days ago
English,
1 month ago
Business Studies,
1 month ago
India Languages,
9 months ago
Science,
9 months ago
English,
9 months ago