ITeye博客

判断截串sql 以及 树递归查询函数

yjkun · 2012-05-21 16:52 · 数据库 · SQL · Markdown

网址如果包含http://www则截掉 不包含www则 截掉 http:// select decode(INSTR(t.home_web_url, 'www', 1, 1),0,substr(t.home_web_url,8,length(t.home_web_url)-8),substr(t.home_web_url,12,length(t.home_web_url)-12)) from ipms_website_now t

instr:查找字符串出现位置 instr(a,b,c,d) 表示在 a从c开始第d次b出现的位置 c,d为可选默认1

父取子 select * from ipms_subject t connect by prior t.id = t.parent_id start with t.id = "?" //父id

子取父 select * from ipms_subject t connect by prior t.parent_id = t.id start with t.id = "?" //子孙id

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。