Re: Function Syntax Help - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: Function Syntax Help
Date
Msg-id 53AC49A7.2020704@iol.ie
Whole thread Raw
In response to Function Syntax Help  (Dennis Ryan <dennis@kabonkulator.com>)
Responses Re: Function Syntax Help
Re: Function Syntax Help
List pgsql-general
On 25/06/2014 23:19, Dennis Ryan wrote:
> I having trouble with correct syntax to get this trigger function to
> compile.  I have tried every combination of removing the ‘;’ characters
> but the function will not compile.  Can someone tell me what I am doing
> wrong, I am stumped. I will be adding addition when clauses the case
> statement once I get this simplified version to compile.
>
> I am using 9.3.4, both postgres and psql.
>
>
> CREATE OR REPLACE FUNCTION sn_dm_b.pm_insert_trigger()
> RETURNS TRIGGER AS $$
> BEGIN
>     CASE
>         WHEN NEW.period =  201001
>                 THEN INSERT INTO sn_dm_b.pm201001 VALUES (NEW.*);

The problem is the semi-colon after (NEW.*). There isn't one inside a
CASE construct.

Ray.


>     END;
>     RETURN NULL;
> END;
> $$ LANGUAGE plpgsql;
>
>
> ERROR:  syntax error at or near ";"
> LINE 7:     END;


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie


pgsql-general by date:

Previous
From: Karthik Iyer
Date:
Subject: Re: DATA corruption after promoting slave to master
Next
From: Pavel Stehule
Date:
Subject: Re: Function Syntax Help