原理:使用笛卡尔积生成行号,用来在该行中返回字符串中的每个字符。
select substr(e.字符串字段,iter.position,1) as C
from(select 字符串字段 from 目标串表 where 字符串字段=某个字符串) e,
(select id as position from 序列表) iter
where iter.position<=length(e.字符串字段)
步骤总结:
①用一个只存在递增序列的表与目标字符串所属的表(内联视图,只存在目标串)进行笛卡尔积运算。(序列表行数>=目标串长度)
②过滤掉序列值大于串长的行。
③用窗口函数substr进行取字符。