oracle取数字,替换字符,查询树形结构,(+)
2016-08-11 10:42
483 查看
select regexp_substr('ED2WCSID_PH_20110324.txt','[0-9]+',5) from dual
结果:20110324
select regexp_substr('EDWCSID_PH_20110324.txt','[0-9]+') from dual
结果:20110324
1 case when
select distinct t.RPTID as rid,t.start_year as 起始年 ,t.start_month as 起始月 ,t.end_year as 截至年 , t.end_month
as 截至月,
( CASE WHEN t.reporttype = 'month' THEN '月报'
ELSE '年报'
END
)as 报表类型 ,( CASE WHEN t.reporthome = 'gf' THEN '股份'
ELSE '集团'
END
) as 报表归属, t.operationname as 修改人,t.operationtime as 修改日期 ,v.rvVersion as 版本
from REPORT_RATE t join RPTVERSION v on t.RPTVID=v.RVID left join reportinfo r on t.rptcode=r.rptcode order by t.rptid
2 decode
select distinct t.RPTID as rid,t.start_year as 起始年 ,t.start_month as 起始月 ,t.end_year as 截至年 , t.end_month
as 截至月,
( CASE WHEN t.reporttype = 'month' THEN '月报'
ELSE '年报'
END
)as 报表类型 ,( CASE WHEN t.reporthome = 'gf' THEN '股份'
ELSE '集团'
END
) as 报表归属, t.operationname as 修改人,t.operationtime as 修改日期 ,v.rvVersion as 版本
,decode(t.reporthome,'gf','股份','jt','集团','其他')
from REPORT_RATE t join RPTVERSION v on t.RPTVID=v.RVID left join reportinfo r on t.rptcode=r.rptcode order by t.rptid
3 repalce
select
replace(replace(t.reporthome,'jt','集团'),'gf','股份')
from report_rate t
start with ONNECT BY PRIOR
1,
select t.ciid ,t.cicode,t.ciscode,t.ciname name,t.cispcode parentId,T.CORBELONG,
p.ciscode pscode,p.ciname pname,t.ciname
from corinfo t,(select * from corinfo ci where ci.civalid='1') p
where 1=1 and t.cispcode = p.cicode(+) AND T.CORBELONG ='gf'
and t.ciscode not like 'T%' and t.ciscode not like 'UT%' and t.ciscode not like 'LD%' and t.ciscode not like 'HW%'
order by t.ciscode desc ,
2,
select t.ciid ,t.cicode,t.ciscode, t.ciname name,T.cispcode parentId, p.ciscode pscode,p.ciname pname ,t.cilevel,b.cbfolder,t.ciname
from corinfo t,corboe b,(select * from corinfo ci where ci.civalid='1') p
where 1=1 and t.civalid = '1' and
t.CIID = b.CIID and b.CBVALID = 1 and t.cispcode = p.cicode(+)
and t.rvid is not null
AND T.CORBELONG ='gf'
and t.ciscode not like 'T%' and t.ciscode not like 'UT%' and t.ciscode not like 'LD%' and t.ciscode not like 'HW%'
start with t.cispcode = 0 CONNECT BY PRIOR t.cicode = t.cispcode ORDER BY t.ciname asc
结果:20110324
select regexp_substr('EDWCSID_PH_20110324.txt','[0-9]+') from dual
结果:20110324
1 case when
select distinct t.RPTID as rid,t.start_year as 起始年 ,t.start_month as 起始月 ,t.end_year as 截至年 , t.end_month
as 截至月,
( CASE WHEN t.reporttype = 'month' THEN '月报'
ELSE '年报'
END
)as 报表类型 ,( CASE WHEN t.reporthome = 'gf' THEN '股份'
ELSE '集团'
END
) as 报表归属, t.operationname as 修改人,t.operationtime as 修改日期 ,v.rvVersion as 版本
from REPORT_RATE t join RPTVERSION v on t.RPTVID=v.RVID left join reportinfo r on t.rptcode=r.rptcode order by t.rptid
2 decode
select distinct t.RPTID as rid,t.start_year as 起始年 ,t.start_month as 起始月 ,t.end_year as 截至年 , t.end_month
as 截至月,
( CASE WHEN t.reporttype = 'month' THEN '月报'
ELSE '年报'
END
)as 报表类型 ,( CASE WHEN t.reporthome = 'gf' THEN '股份'
ELSE '集团'
END
) as 报表归属, t.operationname as 修改人,t.operationtime as 修改日期 ,v.rvVersion as 版本
,decode(t.reporthome,'gf','股份','jt','集团','其他')
from REPORT_RATE t join RPTVERSION v on t.RPTVID=v.RVID left join reportinfo r on t.rptcode=r.rptcode order by t.rptid
3 repalce
select
replace(replace(t.reporthome,'jt','集团'),'gf','股份')
from report_rate t
start with ONNECT BY PRIOR
1,
select t.ciid ,t.cicode,t.ciscode,t.ciname name,t.cispcode parentId,T.CORBELONG,
p.ciscode pscode,p.ciname pname,t.ciname
from corinfo t,(select * from corinfo ci where ci.civalid='1') p
where 1=1 and t.cispcode = p.cicode(+) AND T.CORBELONG ='gf'
and t.ciscode not like 'T%' and t.ciscode not like 'UT%' and t.ciscode not like 'LD%' and t.ciscode not like 'HW%'
order by t.ciscode desc ,
2,
select t.ciid ,t.cicode,t.ciscode, t.ciname name,T.cispcode parentId, p.ciscode pscode,p.ciname pname ,t.cilevel,b.cbfolder,t.ciname
from corinfo t,corboe b,(select * from corinfo ci where ci.civalid='1') p
where 1=1 and t.civalid = '1' and
t.CIID = b.CIID and b.CBVALID = 1 and t.cispcode = p.cicode(+)
and t.rvid is not null
AND T.CORBELONG ='gf'
and t.ciscode not like 'T%' and t.ciscode not like 'UT%' and t.ciscode not like 'LD%' and t.ciscode not like 'HW%'
start with t.cispcode = 0 CONNECT BY PRIOR t.cicode = t.cispcode ORDER BY t.ciname asc
相关文章推荐
- oracle查询字符根据正则表达式替换字符函数
- Oracle将字符串转换为数字,并替换特殊字符
- Oracle查询树形结构
- 数据库Oracle、Sql Server单表树形结构数据查询语句
- oracle 树形表结构查询 排序
- oracle 查询树形结构最底级节点
- ORACLE树形结构查询
- Oracle SQL树形结构查询
- oracle 查询数据生成树形结构
- oracle查询树形结构某层级节点及叶子节点
- oracle 树形结构单表 查询 递归SQL
- oracle树形结构实行查询
- Oracle树形结构查询
- oracle的查询语句中判断字符是否是全数字
- day17 oracle ----查询(select) ---(BETWEEN ... AND... ,IN(list), LIKE , IS NULL , AND ,OR, NOT) ---(字符 , 数字 ,日期, 转换
- ORACLE 树形结构数据 查询某结点下全部子节点无限递归的前2个数据
- Oracle查询树形结构
- Oracle恢复删除数据 && connect by 树形结构查询
- Oracle SQL树形结构查询
- Oracle将字符串转换为数字,并替换特殊字符