Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a date range for the Previous Month programatically

Status
Not open for further replies.

LeonelSanchezJr

Programmer
Jan 26, 2001
522
US
How can I get a date range for the previous month?

Example:

I have a report that needs to run on the 10th day of each month, but I need a START_DATE and an END_DATE returned via PL/SQL.


Thanks,

Leo ;-)
 
Leonel,

Didn't we just do something similar with you last Saturday? Here is a way to do what you want in PL/SQL:
Code:
DECLARE
   START_DATE   DATE := trunc(add_months(sysdate,-1),'MM');
   END_DATE     DATE := Last_Day(Add_Months(SYSDATE,-1));
BEGIN
...
END;
/

Let us know if this resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 19:20 (13Aug04) UTC (aka "GMT" and "Zulu"), 12:20 (13Aug04) Mountain Time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top