create table t(id int, dest int, emp int);
insert into t
select 1,893106,0 union all
select 2,717205,1 union all
select 3,888305,0 union all
select 4,312301,1 union all
select 5,645100,0 union all
select 6,222001,0 union all
select 7,761104,1;
commit;
with main_data
as (
select *,case when emp=0 and lag(emp) over(order by id)=1 then
1
else 0
end as grp_val
from t
)
select *,sum(grp_val) over(order by id) as grp
from main_data;