Hi
I was wondering if someone may kindly help me convert the following function written in plpgsql into c language:
----------Function---------
CREATE FUNCTION fn_asset_tr_archive() RETURNS OPAQUE AS'
BEGIN
/* TG_OP is the function(UPDATE,DELETE,INSERT) */
INSERT INTO asset_tr_archive
VALUES
(OLD.asset_id, OLD.asset_name, OLD.owner, NEW.owner, NEW.trans_id, OLD.trans_value, NEW.trans_on)
;
/* the record should only be archived whenever the owner changes */
IF NEW.owner != OLD.owner
THEN TG_OP = ''UPDATE'';
RETURN NEW;
END IF;
RETURN OLD;
END;
' LANGUAGE 'plpgsql';
----------Function---------
Your time and help would be much appreciated.
Rgds
Brenda
I was wondering if someone may kindly help me convert the following function written in plpgsql into c language:
----------Function---------
CREATE FUNCTION fn_asset_tr_archive() RETURNS OPAQUE AS'
BEGIN
/* TG_OP is the function(UPDATE,DELETE,INSERT) */
INSERT INTO asset_tr_archive
VALUES
(OLD.asset_id, OLD.asset_name, OLD.owner, NEW.owner, NEW.trans_id, OLD.trans_value, NEW.trans_on)
;
/* the record should only be archived whenever the owner changes */
IF NEW.owner != OLD.owner
THEN TG_OP = ''UPDATE'';
RETURN NEW;
END IF;
RETURN OLD;
END;
' LANGUAGE 'plpgsql';
----------Function---------
Your time and help would be much appreciated.
Rgds
Brenda