Hi,
I have a trigger as below.
I am wondering why when I tried to insert to master table with date=
20080908,
the trigger does not insert to z_agg_tmcarr_pfx_gtwy_cc_w_20080908.
Is that something wrong with the statement "ELSEIF NEW.CallDate >=
20080908 AND NEW.CallDate <= 20080914 THEN"?
--------------------------------------------------
CREATE OR REPLACE FUNCTION t_agg_tmcarr_pfx_gtwy_cc()
RETURNS "trigger" AS
$BODY$
DECLARE
BEGIN
IF (TG_OP = 'INSERT') THEN
IF NEW.CallDate >= 20080901 AND NEW.CallDate <= 20080907 THEN
INSERT INTO z_agg_tmcarr_pfx_gtwy_cc_w_20080901 VALUES
( NEW.* );
ELSEIF NEW.CallDate >= 20080908 AND NEW.CallDate <= 20080914
THEN
INSERT INTO z_agg_tmcarr_pfx_gtwy_cc_w_20080908 VALUES
( NEW.* );
ELSEIF NEW.CallDate >= 20080915 AND NEW.CallDate <= 20080921
THEN
INSERT INTO z_agg_tmcarr_pfx_gtwy_cc_w_20080915 VALUES
( NEW.* );
END IF;
END IF;
RETURN NULL;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION t_agg_tmcarr_pfx_gtwy_cc() OWNER TO sa;
--
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general