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!

Date periods

744152Jun 1 2010 — edited Jun 1 2010
Hi all,

I have the following
CREATE TABLE adjustment (
  id NUMBER(19, 0) NOT NULL, 
  startDate DATE,
  interval INTEGER,
  occurrence INTEGER,
  PRIMARY KEY(id)
);
INSERT INTO adjustment VALUES(1, '2010-06-01', 4, 4);
INSERT INTO adjustment VALUES(2, '2010-06-01', 1, 12);
Basically it is a table for adjustment dates that are based on a start date, an interval in months and an occurrence.
What I am trying to achieve is a single query where the results contain the row id and each adjustment interval date. So running the query on the above will result in the following.
1, '2010-06-01'
1, '2010-10-01'
1, '2011-02-01'
1, '2011-06-01'
2, '2010-06-01'
2, '2010-07-01'
2, '2010-08-01'
2, '2010-09-01'
2, '2010-10-01'
... etc
I am fully aware that this is not the best data design in the world, but unfortunately that is out of my control.

I'm not entirely sure if this is possible, and if it is, how to go about it.
Any help would be much appreciated.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2010
Added on Jun 1 2010
4 comments
897 views