exception.
The advantage of this approch is that you can customise your your messages user friendly rather
oracle messages.
Example:- Write a pl sql block to accept first_name from user return his/her last_name.
declare
v_name varchar2(20);
begin
select last_name into v_name from employees
where first_name='&fname';
dbms_output.put_line('First_name of an employee is'||v_name);
Exception
when too_many_rows then
dbms_output.put_line('There are multiple employeesin this department');
end;
The Foll is the output
caught TOO_MANY_ROWS exception..
Enter value for fname: John
old 5: where first_name='&fname';
new 5: where first_name='John';
There are multiple employeesin this department
PL/SQL procedure successfully completed.
0 comments:
Post a Comment
Thank you for your comments we will get back to soon