Skip to content
Advertisement

Display all matched records using Oracle Query

I have query in Oracle using Connect by Level to display all matched records with regexp_substr but it doesn’t display all, I need to change the Connect by Level from +1 to +8 to get all the result. What if the matches are more than that in the future? I want to capture regardless how many matches without changing the +1 to +10 or +20, etc. Is there any easiest and fastest approach?

Here’s my query:

Advertisement

Answer

Your connect by clause should be

instead of

But if you want to apply this solution to a table with more rows, you will need to add this :

to your connect by clause.

So your query should ultimately be this :

demo

For further explanation

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement