From: | "hendra kusuma" <penguinroad(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | exception |
Date: | 2008-11-13 05:41:46 |
Message-ID: | 26dadb3d0811122141j154ff500y77bb9ea3d86c2a10@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dear all,
I'll have a little question here
I try to catch an exception as follows
CREATE OR REPLACE FUNCTION gruptambah(pnama character varying)
RETURNS integer AS
$BODY$
declare
ret integer;
begin
insert into grup (nama_grup, mulai_dibuat) values (pNama, now());
select last_value into ret from grup_id_seq;
return ret;
EXCEPTION
WHEN unique_violation THEN
RAISE NOTICE 'error';
return 0;
end;
$BODY$
LANGUAGE 'plpgsql';
it works perfectly
but I really like to ask if there is a way to catch any exeption
instead of defining what exception we would like to catch?
something like ELSE or what :)
Regards
Hendra
From | Date | Subject | |
---|---|---|---|
Next Message | Klint Gore | 2008-11-13 06:00:31 | Re: exception |
Previous Message | brian | 2008-11-13 02:44:45 | Re: Stored function - send array as parameter to stored function |