Search Postgresql Archives

Function Syntax Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.*);
    END;
    RETURN NULL;
END;
$$ LANGUAGE plpgsql;


ERROR:  syntax error at or near ";"
LINE 7:     END;

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux