Hi
I have two small tables
1) ServiceMaster
Name Null? Type
----------------------------------------- -------- --------------------
ID NOT NULL NUMBER
NAME VARCHAR2(20)
2) Users
Name Null? Type
----------------------------------------- -------- ---------------
USERID NOT NULL NUMBER(10) (Primary Key)
USERNAME VARCHAR2(20) (Unique Index)
PASSWORD VARCHAR2(10)
SERVICEID NUMBER (References ServiceMaster)
I am writing a function to insert data into Users Table. And This procedure should not fire any exception on server as it is used by java program. There I want to handle 2 exceptions which occur on web server running.
My Code of the Function
create or replace function ins1(uid in number,uname in varchar2,
pword in varchar2, eno in number, sname in varchar2) return number is
cl number;
begin
select id into cl from servicemaster where name = sname;
insert into users values(uid,uname,pword,eno);
return 1;
exception when no_data_found then return 0;
exception when dup_val_on_index then return 0;
end;
/
But the function seems cannot handle 2 exceptions at ones. I have written following procedure which works very fine if I handle any one of two exceptions but it does not even compile if I handle both. Can Anyone let me know how to handle multiple exceptions in one
Amol