community.borland.com

Article #25256: Manipulating Dates Inside a Stored Procedure

Problem:
Manipulating Dates Inside a Stored Procedure

Solution:
This procedure adds 30 days to today's date: 

create procedure insert_next_month
as
declare variable d1 date;
declare variable d2 date;
begin
  d1 = "now";
  d2 = d1 + 30;
  insert into foo (today_date, next_month) values ("today", :d2);
end!!

This procedure subtracts 30 days from today's date (using "now" to record time as well): 

create procedure insert_last_month
as
declare variable d1 date;
declare variable d2 date;
begin
  d1 = "now";
  d2 = d1 - 30;
  insert into foo (today_date, last_month) values ("now", :d2);
end!!

Last Modified: 02-OCT-00