Oracle SQL Loop with date change

hello all

I create this stage table with how customers looked on '01-JAN-2016', this table then goes through to other tables to see how they looked on that day. for example were they activated for online use on '01-JAN-2016', how did they pay etc.

I then dump all that data into one table with a from_date with the day they joined the company and a default to_date of '31-DEC-9999', then I repeat this process for '02-JAN-2016' and compare the two tables, if there was a change I'd make the to_date of line one '01-JAN-2016' so the from_date of line two is '02-JAN-2016' and now the to_date is '31-DEC-9999'.

I want to be able to repeat this process until the present day.

is this possible in SQL?

Many Thanks

Mac
example-customer.xlsx
mehul bhaktaAsked:
Who is Participating?
 
ste5anSenior DeveloperCommented:
Not enough information. Post a concise and complete example. Include table DDL and sample data as INSERT statements as runnable script.

Cause: According to your description, there is no need for a loop. Sounds like a simple set-based approach. But without knowing the details, it's hard to give concrete advice.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.