Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help with PL/SQl .....Sysdate-1

685412Feb 16 2009 — edited Feb 16 2009
Hi all ..Need help with this

to_char(last_day(add_months(sysdate,-1)),'mm/dd/yyyy')

Its an Oracle 10g. We use two schemas out of many for Enterprise wide DW. They have 9 base tables in one of the schemas.. We have hundreds of views from that base tables . This SQL command is against one of the view . We basically need all the applications made by customers drilled by region,area,city etc. in the last month using this command.
Here we are using sysdate - 1 to retrieve reports for the last months data. These reports are run monthly on first business day once. But due to any problem if it runs after 3rd or 4th of the month it returns data from last months 3rd to this months 3rd which is logically wrong. Is there any solution so that whenever the report may run it has to return last months data from first of last month to last day of last month. It would be of great help if anyone gives the solution.

Thanks
Tom
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 16 2009
Added on Feb 16 2009
2 comments
747 views