ORA-30004 when using SYS_CONNECT_BY_PATH function, cannot have seperator as part of the column
Action: Use another seperator which does not occur in any column
value, then retry.
Error on:
select ...
Sys_Connect_By_Path(myVariable || ':' || mySecondVariable, ' --> ') "myNewVar",
...
Works:
select ...
Sys_Connect_By_Path(myVariable || ':' || mySecondVariable, ' -> ') "myNewVar",
...
In the data we found some text like this
SomeText B--More TextSomeText A--More Text
Since there is no '-->' or for that mater no ‘-->‘ in the data why does the first one error? The second one has a space in front and on the end.
Thats because
--is a part of-->separator but not a part of->separator.Even if your data value has
-->this query should not error. Like below.The separator above is
-->, notice the whitespace. This whitespace is considered as part of the separator i.e.chr(1)||chr(45)||chr(45)||chr(62)||chr(1). This entire string is not a part of your data or column value.Where as below would error
The separator above is
-->, notice there is no whitespace i.e.chr(45)||chr(45)||chr(62). This entire string is indeed a part of your data or column value and hence the error.And here’s a solution (performance un-tested)
Explanation – Here(in the query above)
->(with space) is not part of the data here i.e.-->. Once the column is conected by path theregexp_replacereplaces all occurences of->with-->so this way you still get to have-->as your separator instead of->.