遍历树结构
SELECT SWJGJC,
CONNECT_BY_ROOT SWJGJC AS "root",
CONNECT_BY_ISLEAF AS "isleaf",
LEVEL,
SYS_CONNECT_BY_PATH(SWJGJC, '/') AS "path"
FROM DM_GY_SWJG_JH
START WITH SWJG_DM = '23307000000'
CONNECT BY PRIOR SWJG_DM = SJSWJG_DM;
遍历特性
1. 生成 1 .. 10 序号
SELECT ROWNUM FROM DUAL CONNECT BY ROWNUM <= 10;
2. 把 16 进制数'abc'转换成十进制(遍历每个位数做处理)
SELECT SUM((CASE UPPER(SUBSTR('abc', ROWNUM, 1))
WHEN 'A' THEN
'10'
WHEN 'B' THEN
'11'
WHEN 'C' THEN
'12'
WHEN 'D' THEN
'13'
WHEN 'E' THEN
'14'
WHEN 'F' THEN
'15'
ELSE
SUBSTR('abc', ROWNUM, 1)
END) * POWER(16, LENGTH('abc') - ROWNUM)) DATA
FROM DUAL
CONNECT BY ROWNUM <= LENGTH('abc');
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于