On 06/25/2014 05:19 PM, Dennis Ryan wrote:
CASE WHEN NEW.period = 201001 THEN INSERT INTO sn_dm_b.pm201001 VALUES (NEW.*); END;
You can't just have a bare CASE statement in plpgsql. Try this: CREATE OR REPLACE FUNCTION sn_dm_b.pm_insert_trigger() RETURNS TRIGGER AS $$ BEGIN IF NEW.period = 201001 THEN INSERT INTO sn_dm_b.pm201001 VALUES (NEW.*); END IF; RETURN NULL; END; $$ LANGUAGE plpgsql; -- 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