Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Is there a cleaner way to remove the 1st 3 characters?

mtMay 19 2022 — edited May 19 2022

my query is:
select id, parent_ID,Name ,
sys_connect_by_path(NAME, ' : ') NAME_PATH
from table
connect by prior id = parent_ID
it's great, but I want to remove the leading ' : ' so I'm using:
SUBSTR(SYS_CONNECT_BY_PATH(NAME,' : '), 3, LENGTH(SYS_CONNECT_BY_PATH,' : '))-3) NAME_PATH
BUT:
Is there a cleaner way to write that?
Why does my NAME_Path lose the last character from its string? (I end up with Chil instead of Child)
Thank you
MT in NY (yes, I've tried to update my profile)
(internal ref: coa,position)

This post has been answered by mathguy on May 19 2022
Jump to Answer
Comments
Post Details
Added on May 19 2022
6 comments
5,685 views