表格如下:
YEAR | MONTH | HOLIDAY |
2015 | 10 | # # # ### |
2015 | 11 | # # # # # |
我想创建以下内容:
YEAR | MONTH | DATE | VALUE |
2015 | 10 | 01 | # |
2015 | 10 | 02 | |
2015 | 10 | 03 | |
2015 | 10 | 04 | # |
UNTIL
2016 | 11 | 30 | # |
我已经在堆栈周围看到了一些解决方案,但它无法工作 任何帮助都会非常感激
答案 0 :(得分:3)
嗯,我不确定你为什么要去11月31日,这个日期并不存在。但是,这是一个想法:
with n as (
select level as n
from dual
connect by level <= 31
)
select t.year, t.month, n.n as day,
substr(t.holidays, n.n, 1) as holiday
from t join
n
on n.n <= length(t.holiday);