Select data from char position to the next

General

Select data from char position to the next

I have a column which is a text like this-

Col = '/a/bbb/cc/aaa/ddd'

I want to output only bbb. That is everything between 2nd "/" and 3rd "/". How should I go about doing this?

Tags (1)
2 REPLIES

Re: Select data from char position to the next

Check if this works.

SEL SUBSTR('/a/bbb/cc/aaa/ddd', INSTR ('/a/bbb/cc/aaa/ddd' , '/',1,2)+1,  INSTR ('/a/bbb/cc/aaa/ddd' , '/',1,3) - INSTR ('/a/bbb/cc/aaa/ddd' , '/',1,2)-1)

Re: Select data from char position to the next

Hi.

Try STRTOK('/a/bbb/cc/aaa/ddd','/',2)

HTH.

Cheers.

Carlos.