Public feed #721562

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-10-01 10:29 UTC
rendered paste body
-- NAME: orders_check_for_payment_status ()
-- RETURNS: "trigger"
-- Language: plpgsql
-- Triggered on: UPDATE, INSERT on orders table
--
-- monitors payment_status, if it's 1 then sets the internal_id to the next increment value.
--

BEGIN
	--check to see if payment status was changed to 1
	IF(NEW.payment_status = 1) THEN
		NEW.internal_id := nextval('orders_internal_id_seq')
	END IF;
	return NEW;
END;