Re: sql question - hierarchy
Date: 26 Mar 2003 08:05:31 -0800
Message-ID: <130ba93a.0303260805.a762f7d_at_posting.google.com>
"mario" <mario.jozak_at_ri.hinet.hr> wrote in message news:<b5qgv4$8tqo$1_at_as201.hinet.hr>...
> > > I tried with CONNECT BY clause but I couldn't get the desired result.
> > > Is it possible to write an SQL query returning the result described
> above?
> >
> > Yes, it is possible. But I have a suspicion that this is your homework,
> > so, unless you prove otherwise, you'll have to figure it out yourself -
> it's
> > actually pretty easy.
> >
> Actually, I have solved the problem, using function that is returning
> master_org_id of currnet_org_id. What I was asking was, is there a simple
> and better solution to solve this. Of course, without using a function,
> query would be faster and better and that is the query that I'm looking for.
> So, if you have a that kind of solution, please post it, otherwise, please
> don't write answers like this one...
> Thanks....
Not sure what's the logic in your function. But, one way to do this is to just join the table and parse the root node name out of sys_connect_by_path. A couple of substr, instr. Performance should not be too bad.
- Jusung Yang
