postgresql7.1
select current_timestamp
select (
case when EXTRACT(DOW FROM TIMESTAMP 'today') = 0
then
to_char('now'::date + '1 day'::interval,'YYYY-MM-DD HH:MM:SS')
when EXTRACT(DOW FROM TIMESTAMP 'today') = 1
then
to_char('now'::date,'YYYY-MM-DD')
when EXTRACT(DOW FROM TIMESTAMP 'today') = 2
then
to_char('now'::date + '6 days'::interval,'YYYY-MM-DD HH:MM:SS')
when EXTRACT(DOW FROM TIMESTAMP 'today') = 3
then
to_char('now'::date + '5 days'::interval,'YYYY-MM-DD HH:MM:SS')
when EXTRACT(DOW FROM TIMESTAMP 'today') = 4
then
to_char('now'::date + '4 days'::interval,'YYYY-MM-DD HH:MM:SS')
when EXTRACT(DOW FROM TIMESTAMP 'today') = 5
then
to_char('now'::date + '3 days'::interval,'YYYY-MM-DD HH:MM:SS')
when EXTRACT(DOW FROM TIMESTAMP 'today') = 6
then
to_char('now'::date + '2 days'::interval,'YYYY-MM-DD HH:MM:SS')
end) as next_week
select to_char('now'::date + '1 month'::interval,'YYYY-MM-DD HH:MM:SS')
select press__archive(:id,:archive_date)
select press__make_permanent(:id)
select press__delete(:id)