hive 和 oracle 切割列转行的做法
数据大概这样
原始
字段1 字段2
大 a;b;c
中 e;f;g
小 h;i;j
目标
字段1 字段2
大 a
大 b
大 c
中 e
。。。
hive 方法
select 字段1,tmptable.tmpcol from table lateral view explode(字段2) tmptable as tmpcol;
oracle 方法
select 字段1,regexp_substr(字段2,'[^;]+',1,level) from table connect by regexp_substr(字段2,'[^;]+',1,level) is not null;