For Billy Verreynne

From: Alex Kizub <akizub_at_yahoo.com>
Date: 27 Aug 2004 09:58:19 -0700
Message-ID: <9d4ba33b.0408270858.4e15df4d_at_posting.google.com>



Billy:
I like your answers in the groups.
Especially something like this:

Damn, don't you just love SQL! :-)
I have yet to find a query that can not be done in SQL.. I feel that I'm wrong but here is task which I can't solve in sql.
Can you?

Problem is I can't use PL/SQL for two reasons: 1) I work trough JDBC
2) Our DBA do not give me permission to use any procedure.

Actually I have third reason - this is not our database, we can read only and
it is so big and impractical... It looks for me that they don't know anything
about relations and just use tables as flat files :(((

Anyway, here is question.
We have table which holds tree structure in such way:

              View 1
Owner     Item      Sequence      Level
a         a1        1             1
a         a2        2             2
a         a3        3             3
a         a4        4             1
a         a5        5             2
b         b1        1             1
b         b2        2             1
b         b3        3             2
b         b4        4             3

I need SQL which produces each item with its path. Like this

              View 2
Owner     Item      Level1     Level2    Level3
a         a1        a1
a         a2        a1         a2
a         a3        a1         a2        a3
a         a4        a4
a         a4        a4         a5
b         b1        b1
b         b2        b2
b         b3        b2         b3
b         b4        b2         b3        b4

Problem is that this table is huge, has many owners and each of them
has own sequence.

Of course I can do it in the application. Even they do it in this way.
They have special process (which they run every week :) which
translates table with View 1 to additioanal table with View 2.
Of course such "syncronization" only makes whole system worse :(((

Any idea how I can use SQL only to handle this?

Thanks in advance,
Alex Kizub.

P.S. Your e-mail address is not good.
I got this:
This Message was undeliverable due to the following reason:

The following destination addresses were unknown (please check the addresses and re-mail the message):

SMTP <vslabs_at_onwe.co.za>

Please reply to <postmaster_at_tiscali.co.za> if you feel this message to be in error. Received on Fri Aug 27 2004 - 18:58:19 CEST

Original text of this message