17,090
社区成员
发帖
与我相关
我的任务
分享
SELECT substr('http://www.csdn.net/point.aspx',
instr('http://www.csdn.net/point.aspx', '.', 1),
instr('http://www.csdn.net/point.aspx', '/', 1, 3) -
instr('http://www.csdn.net/point.aspx', '.', 1))
FROM dual;
--做了个取二级域名的函数,请LZ参考一下:
SQL> CREATE OR REPLACE FUNCTION f_twodomain(http0 IN varchar2) RETURN varchar2 IS
2 v_str_twodomain varchar2(80);
3 begin
4 For i in 12..100
5 Loop
6 if ascii(substr(http0,i,1))=47 then
7 return v_str_twodomain;
8 end if;
9 v_str_twodomain:=v_str_twodomain || substr(http0,i,1);
10 End loop;
11 end;
12 /
Function created
SQL> select f_twodomain('http://www.csdn.net/point.aspx') from dual;
F_TWODOMAIN('HTTP://WWW.CSDN.N
--------------------------------------------------------------------------------
csdn.net
SQL>
select substr(str,instr(str,'w',1,3)+1,(instr(str,'/',1,3)-instr(str,'/',1,2)-4)) from dual
SQL> select substr('http://www.csdn.net/point.aspx',12,8 ) from dual;
SUBSTR('HTTP://WWW.CSDN.NET/PO
----------------------------------------------------------------
csdn.net
SQL>