Using Instr to extract path portion.

Hi all,

I am trying to use the Instr function in Oracle in order to extract the folder part,in order to do that i need to get rid of the ‘’ sign but to keep the text between every ‘’ sign.

Example:

folder_part1\folder_part2\folder_part3\

The outcome should look like:

folder_part1
folder_part2
folder_part3

Any ideas ?

Thanks

Yoav


yohab (BOB member since 2003-12-24)

If you want it output as three separate rows, you will need to do so at the database level unless there is always a known maximum number of options.

The result can appear as a separate column.

I have maximum 10 positions of the folder path.

Thanks

Yoav


yohab (BOB member since 2003-12-24)

It will get a bit messy with 10, but have a read through this thread; Dave’s post should help:

Thanks Mark,

i am looking for a similar logic in Oracle

i’ll see if i can implement it in Oracle.
Yoav


yohab (BOB member since 2003-12-24)

This is code i used:

SELECT regexp_substr(pth,’[^]+’,1,1)
,regexp_substr(pth,’[^]+’,2,2)
,regexp_substr(pth,’[^]+’,3,3)

add as many pieces you need if you have a longer text that need to be separated.

Thanks

Yoav


yohab (BOB member since 2003-12-24)