Hi,
Could you help me creating select that returns rows based on some conditions. Im not sure if it is possible, or I need to create plsql proc to get those data…
Thanks for any tips..
I need find rows partitioned by schedule_id, where p_lock number has changed from 1 to 0 or 0 to 1, excluding rows where p_lock has not changed.
First row retrieved should be where p_lock = 1;
Data :
unique_id, schedule_id, p_lock
10, 15, 0
13, 15, 0
16, 15, 1
19, 15, 0
21, 15, 0
23, 15, 1
24, 15, 0
So from data above I would like to retrieve rows
unique_id, schedule_id, p_lock
16, 15, 1
19, 15, 0
23, 15, 1
24, 15, 0
select 10 as unique_id,15 as schedule_id,0 as p_lock from dual union all
select 13,15,0 from dual union all
select 16,15,1 from dual union all
select 19,15,0 from dual union all
select 22,15,0 from dual union all
select 23,15,1 from dual union all
select 24,15,0 from dual