EXCEPTION clause not identified
| От | Jasbinder Singh Bali |
|---|---|
| Тема | EXCEPTION clause not identified |
| Дата | |
| Msg-id | a47902760705132208y1f56eb6jd2a15026cd64d816@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: EXCEPTION clause not identified
Re: EXCEPTION clause not identified |
| Список | pgsql-general |
Hi,
In one of my trigger functions, i'm trying to catch invalid ip address exception
CREATE OR REPLACE FUNCTION func_client_socket()
RETURNS "trigger" AS
$BODY$
DECLARE
ip_address_present int4;
BEGIN
ip_address_present = 1;
SELECT inet(NEW.canonical_name);
EXCEPTION WHEN invalid_text_representation THEN
ip_address=0;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
when i run this function, it gives me the followin error
ERROR: syntax error at or near "EXCEPTION" at character 1343
which is the line where I have the EXCEPTION clause.
Can anyone please tell me whats going wrong here?
Thanks,
~Jas
In one of my trigger functions, i'm trying to catch invalid ip address exception
CREATE OR REPLACE FUNCTION func_client_socket()
RETURNS "trigger" AS
$BODY$
DECLARE
ip_address_present int4;
BEGIN
ip_address_present = 1;
SELECT inet(NEW.canonical_name);
EXCEPTION WHEN invalid_text_representation THEN
ip_address=0;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
when i run this function, it gives me the followin error
ERROR: syntax error at or near "EXCEPTION" at character 1343
which is the line where I have the EXCEPTION clause.
Can anyone please tell me whats going wrong here?
Thanks,
~Jas
В списке pgsql-general по дате отправления: