Traverse to Parent for the given child in SQL
Hi,
I have a table with below structure and data.
{Code}
CREATE TABLE A
(
CHILD_ID NUMBER,
EVALUE VARCHAR2(100 CHAR),
PARENT_ID NUMBER
)
INSERT INTO A VALUES ( 3803783, 'BLADE', 3803772);
INSERT INTO A VALUES ( 3803772, 'PE', 3803767);
INSERT INTO A VALUES ( 3803767, 'MEC', 0);
INSERT INTO A VALUES ( 3847134, 'DE', 3803767);
INSERT INTO A VALUES ( 3803767, 'MEC', 0);
{code}
I want output string as 'MEC || PE || BLADE' if I start with Child 3803783, similarly I should get 'MEC || DE' if I start with child 3847134
Could you please help me with SQL query.
Regards,
Laxman