Dear All,
I have tried creating a function as follows:
CREATE FUNCTION chkTelephone () RETURNS OPAQUE AS '
BEGIN
IF EXISTS (SELECT *
FROM tenant t
WHERE t.areacode = NEW.areacode AND
t.telephone = NEW.telphone) THEN
RAISE EXCEPTION ''THAT TELEPHONE NUMBER ALREADY EXISTS!'';
END IF;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
However I get the following error:
ERROR: Unrecognized language specified in a CREATE FUNCTION: 'plpgsql'.
Recognized languages are sql, C, internal and the created procedural
languages.
In the documentation it states that 'PL/pgSQL is a loadable procedural
language for the Postgres database system.'. Where can I load it from and
are there any other problems that may arise?
Cheers, Steve.