Could someone tell me what is wrong withthis function - Mailing list pgsql-general

From
Subject Could someone tell me what is wrong withthis function
Date
Msg-id 044801c1d40a$74cdf260$6501a8c0@calvin
Whole thread Raw
Responses Re: Could someone tell me what is wrong withthis function
List pgsql-general
This is almost a copy / paste from Bruce  Momjian's book :
<snip>
        create function trigger_iso_code_2_uppercase()
        returns opaque
        as 'BEGIN
        if new.countrycode !~''^[A-Za-z][A-Za-z]$''
        then raise exception ''ISO-code are excepted to be uppercase
letters.'';
        ENd if;
        new.countrycode=upper(new.countrycode);
        new.countryname=initcap(new.countryname);
        end;'
        language 'internal';
</snip>

but I get the following :

<snip>
        ERROR:  ProcedureCreate: there is no builtin function named "BEGIN
        if new.countrycode !~'^[A-Za-z][A-Za-z]$'
        then raise exception 'ISO-code are excepted to be uppercase
letters.';
        ENd if;
        new.countrycode=upper(new.countrycode);
        new.countryname=initcap(new.countryname);
        end;"
</snip>

Please note that I logging as postgres

tx for your help,

thomas,






--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id : smetsthomas






pgsql-general by date:

Previous
From:
Date:
Subject: rule problem
Next
From: Darren Ferguson
Date:
Subject: Re: Could someone tell me what is wrong withthis function