clear markdown compare help donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 554301 fiddles created (10970 in the last week).

create table stg_application_cdim ( id integer primary key, mig_filename text, mig_insert_dt timestamp );
 hidden batch(es)


CREATE OR REPLACE FUNCTION trigger_fct_tr_stg_application_cdim_ins() RETURNS trigger AS $$ declare v_ErrorCode int; v_ErrorMsg varchar(512); v_Module varchar(32) := 'TR_STG_APPLICATION_CDIM_INS'; begin if TG_OP = 'INSERT' then if new.mig_filename IS NULL then new.mig_filename := 'Unknown'; end if; new.mig_insert_dt = current_timestamp; end if; RETURN NEW; end; $$ language plpgsql;
 hidden batch(es)


CREATE TRIGGER tr_stg_application_cdim_ins BEFORE INSERT OR UPDATE ON stg_application_cdim FOR EACH ROW EXECUTE PROCEDURE trigger_fct_tr_stg_application_cdim_ins();
 hidden batch(es)


insert into stg_application_cdim (id) values (42);
1 rows affected
 hidden batch(es)


select * from stg_application_cdim;
id mig_filename mig_insert_dt
42 Unknown 2019-10-08 19:57:17.01822
 hidden batch(es)