Adding dates in plpgsql
От | Stuart Grimshaw |
---|---|
Тема | Adding dates in plpgsql |
Дата | |
Msg-id | E15wkBD-0006lY-00@garner.smgsystems.co.uk обсуждение исходный текст |
Ответы |
Re: Adding dates in plpgsql
|
Список | pgsql-general |
I have a trigger that needs to do some addition to dates, CREATE FUNCTION update_dis_record () RETURNS OPAQUE AS ' DECLARE tmpYellow INTEGER; tmpBan_Starts timestamp; BEGIN tmpYellow := NEW.yellow % 5; tmpBan_Starts := now + "14 Days"; IF tmpYellow = 0 AND NEW.yellow <> 0 THEN NEW.length := NEW.length + 1; NEW.ban_starts := tmpBan_Starts; END IF; IF NEW.ban_starts <> null THEN NEW.ban_starts := OLD.ban_starts; END IF; RETURN NEW; END; ' LANGUAGE 'plpgsql'; The line "tmpBan_Starts := now + "14 Days"; " doesn't work obviously, but what is the correct way to ad 14 (or any number of ) days to a date with plpgsql? -- | Stuart Grimshaw <stuart@footballnet.com> | Chief Operations Officer | Football Networks Ltd |- | t:07976 625221 | f:0870 7060260
В списке pgsql-general по дате отправления: