Why am I getting Ora-30004 when the sys_connect_by_path delimiter is missing from the column values

I tested this on Oracle versions:
11.2.0.3.0
12.1.0.2.0

The following query throws an ORA-30004 error, but my delimiter '->' is not used in any of the column values:

with temptable as (
  select '2624' as id, 'ninechars' as label, '' as parentid from dual union 
  select '2625' as id, 'erewrettt' as label, '2624' as parentid from dual union 
  select '2626' as id, 'Im stumped' as label, '' as parentid from dual union 
  select '2627' as id, '- Unknown -' as label, '' as parentid from dual
)
select sys_connect_by_path(label, ' -> ' ) 
from temptable
start with parentid is null 
connect by prior id = parentid;


Some observations:

  • Changing the value of "nine characters" to "ninecharsx" allows you to query
  • Changing nine character to abcdefghi also aborts the request
    • All nine character values ​​seem to break the query

  • Leaving the value as "nine characters" and deleting the last join operator that is not associated with any of the other entries allows a job request
  • '- > ' '* > '



ORA-30004? Oracle , ?

: bobdylan pastebin.com/Ad1edFcJ ​​ ,

+4
1

. , ( ), 11.2.0.4:

SQL> with t (id, label, parentid, reportlevel, fake_connect_by_path) as (
  2  select id, label, parentid, 0 as reportlevel, ' -> ' || label as fake_connect_by_path
  3    from temptable
  4   where parentid is null
  5   union all
  6  select tt.id, tt.label, tt.parentid, reportlevel + 1, t.fake_connect_by_path || ' -> ' || tt.label as fake_connect_by_path
  7    from temptable tt
  8    join t on t.id = tt.parentid
  9  )
 10  select fake_connect_by_path
 11    from t;
FAKE_CONNECT_BY_PATH
--------------------------------------------------------------------------------
 -> ninechars
 -> Im stumped
 -> - Unknown -
 -> ninechars -> erewrettt
+1

Source: https://habr.com/ru/post/1626034/


All Articles