Попробуйте это:
with tab (Date, Article, Category) as (values
(20190101, 1234, 'A')
, (20190105, 1234, 'C')
--, (20190108, 1234, 'D')
)
-- We use date arithmetic below,
-- so it's better to understand if we convert int to date beforehand
, mytab (Date, Article, Category) as (
select date(to_date(char(date), 'YYYYMMDD')) as Date, Article, Category
from tab
)
, a (date_max, date, article, category) as (
select g.date_max, m.date, m.article, m.category
from
(
select
article
, min(date) date_min
, max(date) date_max
from mytab
group by article
) g
join mytab m on m.article=g.article and m.date=g.date_min
union all
select
a.date_max, a.date + 1 day as date
, a.article
, coalesce(
(
select m.category
from mytab m
where m.article=a.article and m.date=a.date + 1 day
)
, a.category) as category
from a
where a.date_max <> a.date
)
select
--back to int from date
int(to_char(date, 'YYYYMMDD')) as date
, article, category
from a;