| extract character between points [message #632823] |
Fri, 06 February 2015 02:42  |
 |
mmm286
Messages: 14 Registered: July 2014
|
Junior Member |
|
|
Hi,
I have these string:
make.23.6789.323424.000.ksh
do.1.2342.skdkss.212ksh
I would like to extract the characters always between 3 and 4 point (323424 and skdkss).
How could I do these. I've tried with instr but I cant do it.
Many thanks!
|
|
|
|
|
|
|
|
| Re: extract character between points [message #632831 is a reply to message #632829] |
Fri, 06 February 2015 02:58   |
cookiemonster
Messages: 13975 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You're part of the way there, but that last parameter to substr is obviously wrong.
You need to use another instr call to get the position of the 4th . and then substract the position of the 3rd . to get the number of characters to substr.
|
|
|
|
|
|
| Re: extract character between points [message #632835 is a reply to message #632831] |
Fri, 06 February 2015 03:05   |
 |
mmm286
Messages: 14 Registered: July 2014
|
Junior Member |
|
|
cookiemonster wrote on Fri, 06 February 2015 02:58You're part of the way there, but that last parameter to substr is obviously wrong.
You need to use another instr call to get the position of the 4th . and then substract the position of the 3rd . to get the number of characters to substr.
Thanks but doesn't works
select (substr(xxxx,instr(xxxx, '.',1,3)+1,instr(xxxx,'.',1,4))) xxxx from yyyy ;
|
|
|
|
| Re: extract character between points [message #632837 is a reply to message #632835] |
Fri, 06 February 2015 03:15   |
cookiemonster
Messages: 13975 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
mmm286 wrote on Fri, 06 February 2015 09:05cookiemonster wrote on Fri, 06 February 2015 02:58You're part of the way there, but that last parameter to substr is obviously wrong.
You need to use another instr call to get the position of the 4th . and then substract the position of the 3rd . to get the number of characters to substr.
|
|
|
|
|
|
|
|