## analytic sql question

715939Aug 6 2009 — edited Aug 11 2009 Dear All,

I have the following problem of getting the output table from the input table below.

Do you have any idea of doing this with the help of analytic sql?

p.s. I have done this by using pure plsql block which is too slow to run with high amount of data. Below data is just a sample, in real I have millions rows of data.

Input table:

TIME USER VALUE

1 A X

2 A X

3 B Y

4 B Y

5 A X

5 B X

6 A Y

7 B Y

7 A Y

Output table:

START_TIME END_TIME USER VALUE

1 2 A X

5 5 A X

6 7 A Y

3 4 B Y

5 5 B X

7 7 B Y