DELETE FROM
bnft_hist_actn_ldim;
INSERT INTO
bnft_hist_actn_ldim
SELECT
stg.bnft_hist_actn_id, stg.bnft_hist_actn_src_cd,
stg.bnft_hist_actn_desc, stg.mig_filename
FROM
stg_bnft_hist_actn_ldim stg;
-----
but when I
put in the stored function, it's not working.
My stored
function script is:
CREATE OR REPLACE
FUNCTION pr_mig_stg_bnft_hist_actn_ldim(OUT
v_Ret integer)
AS $$
DECLARE
v_ErrorCode
varchar(32);
v_ErrorMsg
varchar(512);
v_Module
varchar(32) = 'pr_mig_stg_bnft_hist_actn_ldim';
BEGIN
DELETE FROM
bnft_hist_actn_ldim;
INSERT INTO
bnft_hist_actn_ldim
SELECT
stg.bnft_hist_actn_id,
stg.bnft_hist_actn_src_cd,
stg.bnft_hist_actn_desc,
stg.mig_filename
FROM stg_bnft_hist_actn_ldim
stg;
RETURN NEW;
v_Ret := SQLSTATE;
exception
when others then
v_ErrorCode
:= SQLSTATE;
v_ErrorMsg := SQLERRM;
v_Ret :=
v_ErrorCode;
PERFORM
pr_write_error_log ();
END;
$$
LANGUAGE 'plpgsql';
SELECT
pr_mig_bnft_hist_actn_ldim();
execute the store funtion no error
but two tables are the same and didn't delete and/or
insert any from one to other;
thank you for looking into it.
v/r,