dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

How To Raise Exception When Two Errors Occur - Oracle Errors

This is a discussion on How To Raise Exception When Two Errors Occur - Oracle Errors ; Hi This is Shiva kumar Chandramouli In this program if two errors are occurred how to raise them at a time i.e, if x size and y size both are more than length of 4 characters then how to raise ...


Home > Database Forum > Oracle Database > Oracle Errors > How To Raise Exception When Two Errors Occur

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 12-10-2008, 06:11 AM
Database Newbie
 
Join Date: Nov 2008
Posts: 5
xmachine is on a distinguished road
Default How To Raise Exception When Two Errors Occur

Hi
This is Shiva kumar Chandramouli
In this program if two errors are occurred how to raise them at a time
i.e,
if x size and y size both are more than length of 4 characters then how to raise the error

declare
x varchar2(20) := &x;
y varchar2(4) := &y;
z varchar2(4);
p varchar2(4);
x_size_err exception;
y_size_err exception;
xy_size_err exception;
begin
z := length(x);
p :=length(y);
if(z>4)
then
raise X_size_err;
end if;
if(p>4)
then
raise y_size_err;
end if;
if((z>4) and (p>4))
then
raise xy_size_err;
end if;
z :=x/y;
dbms_output.put_line(z);
exception
--case
when xy_size_err
then dbms_output.put_line('x size and y size error');
when x_size_err then
dbms_output.put_line('size mismatch');
when y_size_err
then
dbms_output.put_line('y size mismatch');
when zero_divide then
dbms_output.put_line('dividing with y=0 an error');
-- else
-- dbms_output.put_line('check the entered values');
--end case;
end;

/
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 05:55 AM.