RE: Sql question : use of SUBSTR/INSTR functions

2002-10-16 Thread Mirsky, Greg
<> How about this... FUNCTION f_ip_to_number ( p_ipNVARCHAR2 ) RETURN NUMBER IS v_ip_segment1 NUMBER := SUBSTR (p_ip, 1, INSTR (p_ip, '.') - 1); v_ip_segment2 NUMBER := SUBSTR (

RE: Sql question : use of SUBSTR/INSTR functions

2002-10-16 Thread Sherman, Paul R.
Hello, Try this (take a hard look first, as I cranked this out quickly while doing other things): substr(ip_addr,1,instr(ip_addr,'.',1,1)-1 http://www.orafaq.com -- Author: Johan Muller INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, Cal

Re: Sql question : use of SUBSTR/INSTR functions

2002-10-16 Thread Alan Davey
Hi Johan, Try this: SELECT SUBSTR('127.0.0.1',1,INSTR('127.0.0.1','.')-1) ,SUBSTR('127.0.0.1',INSTR('127.0.0.1','.')+1,INSTR('127.0.0.1','.',1,2)-(INSTR('127.0.0.1','.')+1)) ,SUBSTR('127.0.0.1',INSTR('127.0.0.1','.',1,2)+1,INSTR('127.0.0.1','.',1,3)-(INSTR('127.0.0.1','.',1,2)+1)) ,SUBSTR('127.0.

RE: Sql question : use of SUBSTR/INSTR functions

2002-10-16 Thread Fink, Dan
Try this. It uses the INSTR function to determine the start and end of the SUBSTR. 1 select substr('333.22.1.000',1,instr('333.22.1.000','.')-1) octet1, 2 substr('333.22.1.000', 3(instr('333.22.1.000','.',1,1) + 1), 4(instr('333.22.1.000','.',1,2)