Job Search

Thursday, October 22, 2015

calling procedure error handling

Question: Two procedures are created, proca and procb, procb includes some logic without any exception handling block, proca is used to call procb with exception handling block,
what will be the result of this scenario.

Answer: When we create any procedure with exception handling block then error is handled by this block.

Description:

-----procb------------------------
create or replace procedure procb is
eid employees.employee_id%type;
begin
  select a.employee_id into eid from employees a where a.employee_id=1;
end procb;

-----proca------------------------
create or replace procedure proca is
begin
  dbms_output.put_line('calling proc b');
  procb;
exception
  when others then
    dbms_output.put_line('error in proc b');
end proca;

begin
  -- Call the procedure proca
  proca;
end;

-----Output-----------
calling proc b
error in proc b


I hope you all have enjoyed reading this article. Comments are welcome....

No comments:

Post a Comment