2014-06-26 18:28 GMT+02:00 Shaun Thomas <sthomas@xxxxxxxxxxxxxxxx>:
On 06/25/2014 05:19 PM, Dennis Ryan wrote:You can't just have a bare CASE statement in plpgsql. Try this:
CASE
WHEN NEW.period = 201001
THEN INSERT INTO sn_dm_b.pm201001 VALUES (NEW.*);
END;
IF NEW.period = 201001 THEN
CREATE OR REPLACE FUNCTION sn_dm_b.pm_insert_trigger()
RETURNS TRIGGER AS $$
BEGINEND IF;
INSERT INTO sn_dm_b.pm201001 VALUES (NEW.*);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
or use a plpgsql case http://www.postgresql.org/docs/9.3/static/plpgsql-control-structures.html#PLPGSQL-CONDITIONALS
Regards
Pavel
--
Shaun Thomas
OptionsHouse, LLC | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604
312-676-8870
sthomas@xxxxxxxxxxxxxxxx
______________________________________________
See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general