SQL challenge to any gurus out there

Hi,
I am trying to create a view which shows inheritence but cannot get this right. I have provided the table and data to assist anyone kind enough to help us plus details of what we are trying to achieve.
CREATE TABLE GLEN_TEST (
TYPE VARCHAR2 (10),
PARENT VARCHAR2 (10),
PROPERTY NUMBER);
INSERT INTO GLEN_TEST ( TYPE, PARENT, PROPERTY ) VALUES ( 'A', NULL, 1);
INSERT INTO GLEN_TEST ( TYPE, PARENT, PROPERTY ) VALUES ( 'A', NULL, 2);
INSERT INTO GLEN_TEST ( TYPE, PARENT, PROPERTY ) VALUES ( 'B', 'A', 3);
INSERT INTO GLEN_TEST ( TYPE, PARENT, PROPERTY ) VALUES ( 'B', 'A', 4);
INSERT INTO GLEN_TEST ( TYPE, PARENT, PROPERTY ) VALUES ( 'C', 'B', 5);
INSERT INTO GLEN_TEST ( TYPE, PARENT, PROPERTY ) VALUES ( 'D', 'B', 6);
COMMIT;
We can see that this is a simple child-parent relationship.
If we do a select * we would get the following result:
TYPE PARENT PROPERTY
A null 1
A null 2
B A 3
B A 4
C B 5
D B 6
What we are trying to achieve would look like this:
TYPE PARENT PROPERTY
A null 1
A null 2
B A 1
B A 2
B null 3
B null 4
C A 1
C A 2
C B 3
C B 4
C null 5
D A 1
D A 2
D B 3
D B 4
D null 6
What we are trying to achieve is for every type to show all it's inheritance i.e. type B inherits from type A because A is it's parent so the properties for type B are 3 and 4 plus the properties for type A which are 1 and 2. Type C would have it's own properties (5) plus those from type B (3,4) which is it's parent plus those of type A (1,2) which is B's parent.
I have tried using the connect by prior but with no success as the inheritence could be n layers deep. If anyone out there likes a challenge and can help - we would be extremely grateful.
Regards
Glen

Ups... a little mistake.
This one works...
SELECT DISTINCT glen_test.type type,
       DECODE(level_type.ty,glen_test.type,'null',level_type.ty) parent,
       level_type.property property
  FROM glen_test,
       (SELECT level lev, type ty, property
      FROM glen_test
     START WITH parent is null
     CONNECT BY PRIOR type = parent) level_type,
       (SELECT level lev, type ty
      FROM glen_test
     START WITH parent is null
     CONNECT BY PRIOR type = parent) level_type_1
WHERE glen_test.type = level_type_1.ty
   AND (level_type.lev < level_type_1.lev
   AND level_type.ty IN (SELECT gl_test.type
                  FROM glen_test gl_test
                  START WITH gl_test.type = level_type_1.ty
                  CONNECT BY PRIOR gl_test.parent = gl_test.type))
   OR (glen_test.type = level_type.ty and level_type.lev = level_type_1.lev);
DC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Any gurus out there? iPod and carstereo

    OK guys, I may be a moron, but if anyone would be so kind as to help me out; I would really appreciate it!
    I have the following kit:
    - iPod 30 GB (black iPod Video)
    - Pioneer CD-IB100 (iPod adapter)
    - Pioneer DEH-P70BT (carstereo)
    I connected everything and the carstereo is functioning excellent. When it comes to the iPod, the carstereo can read the menu and connects to the iPod, BUT I can't get any sound out into the loudspeakers.
    Is it possible that the version of iTunes matters?
    Please give me advice.
    Greetings from snowy Norway!

    Hi,
    I had this problem when i first got my cd-Ib100 too, check the P-Link cable that goes from the stereo into the cd-ib100 is plugged in to the correct port on the cd-ib100, there are two ports - one blue and one black, one is for connection to the stereo and one is a pass through so you can connect another device (such as cd changer), if you plug the stereo into the pass through, it appears to work but no sound is heard!
    Liam

  • Multi-master replication questions for iPlanet 5.0, gurus out there?

    hi:
    I'm using iPlanet Dir Server 5.0 and I note that many gurus out there has
    been able
    to get this to work, that's good, but I have yet to. I have several
    questions, maybe
    someone can spend a few minutes and save me hours...
    I have a suffix called dc=calient,dc=net. I followed the suggestions in
    the
    iPlanet install guide and created 2 directory servers
    a) suffix o=NetscapeRoot, at some arbitrary port, 4601
    b) suffix dc=calient,dc=net, at the usual port 389.
    All my searches/create/delete work fine. However, when I try to replicate
    with multi-master between 2 machines, I keep getting into problems.
    Here's one set of questions...
    Q1: do people out there really split their tree from the o=NetscapeRoot
    tree?
    Q2: The admin guide says the the unit of replication is a database, and
    that each replication can only have 1 suffix. Is this true? Can
    a replicated db have more than 1 suffix?
    Q3: If I also want to replicate the o=NetscapeRoot tree, I have to set
    up yet 2 more replication agreements. Isn't this more work? If
    I just lump the 2 suffixes together, wouldn't it be easier? But would
    it work?
    Q4: I followed the instructions to enable replicas on the masters.
    But then I tried to create this cn=Replication Manager, cn=config
    object.
    But what is the object class of this entry? An iPlanet user has uid
    as its RDN... I tried a person object class, and I added a password.
    But then I keep getting error code 32, object not found in the error
    log. What gives? such as
    WARNING: 'get_entry' can't find entry 'cn=replication
    manager,cn=config', err 32
    Q5: Also, are there any access control issues with this cn=Replication
    Manager,
    cn=config object? By this I mean, I cannot seem to see this object
    using
    ldapsearch, I can only see cn=SNMP, cn=config. Also, do I have
    to give all access via aci to my suffix dc=calient,dc=net? Also,
    given the fact that my o=NetscapeRoot tree is at a different port (say
    4601),
    not 389, could this be an issue?
    Q6: when replication fails, should the Dir Server still come up? Mine does
    not anymore
    which is strange. I keep getting things like this in my log file
    [08/Nov/2001:21:49:13 -0800] NSMMReplicationPlugin - Could not send consumer
    mufasa.chromisys.com:389 the bind request
    [08/Nov/2001:21:49:13 -0800] NSMMReplicationPlugin - Failed to connect to
    replication consumer mufasa.chromisys.com:389
    But why shouldn't the dir server itself come up even if replication
    fails?
    steve

    Hi Steve,
    First, please read the 'Deployment Guide'. I think that is easier to
    understand when you want to setup multi-master replication. The
    'Administrator's Guide' gives you step-by-step instructions, but it may
    not help you to understand how to design your directory services.
    Stephen Tsun wrote:
    I have a suffix called dc=calient,dc=net. I followed the suggestions in
    the
    iPlanet install guide and created 2 directory servers
    a) suffix o=NetscapeRoot, at some arbitrary port, 4601
    b) suffix dc=calient,dc=net, at the usual port 389.
    All my searches/create/delete work fine. However, when I try to replicate
    with multi-master between 2 machines, I keep getting into problems.I don't understand something: which backend do you want to replicate?
    The one holding 'o=NetscapeRoot' or the one holding 'dc=calient,dc=net'?
    Do you want to setup replication between these two instances of the
    directory server (i.e. between port 4601 and 389 in your example)?
    Q1: do people out there really split their tree from the o=NetscapeRoot
    tree?If you have multiple directory servers installed in your environment, it
    is probably worth dedicating (at least) one directory server for the
    o=netscaperoot tree.
    Q2: The admin guide says the the unit of replication is a database, and
    that each replication can only have 1 suffix. Is this true? Can
    a replicated db have more than 1 suffix?Well, it is normal, since in iDS 5.x you have 1 suffix per database.
    You can, however, replicate multiple databases.
    Q3: If I also want to replicate the o=NetscapeRoot tree, I have to set
    up yet 2 more replication agreements. Isn't this more work? If
    I just lump the 2 suffixes together, wouldn't it be easier? But would
    it work?You can't lump the 2 suffixes together, because each backend has 1
    suffix associated with.
    Q4: I followed the instructions to enable replicas on the masters.
    But then I tried to create this cn=Replication Manager, cn=config
    object.
    But what is the object class of this entry?Usually, it is organizationalperson or inetorgperson. In most of the
    cases you want an objectclass which can have userPassword attribute.
    An iPlanet user has uid
    as its RDN... I tried a person object class, and I added a password.
    But then I keep getting error code 32, object not found in the error
    log. What gives? such asYou must have misconfigured something. Or perhaps, it is not
    cn=replication manager, cn=config, but 'uid=replication manager,cn=config'
    Q5: Also, are there any access control issues with this cn=Replication
    Manager,
    cn=config object? By this I mean, I cannot seem to see this object
    using
    ldapsearch, I can only see cn=SNMP, cn=config.The configuration tree is protected by ACIs, so you can not see them
    using anonymous BINDs. Try binding as 'directory manager' and you will
    find your entry.
    Also, do I have
    to give all access via aci to my suffix dc=calient,dc=net?For what purpose? For replication, it is enough to set user DN in the
    replication agreement and this user can update the replicated backend.
    Q6: when replication fails, should the Dir Server still come up?Yes.
    Bertold

  • Any software out there to update JDK1.0 source code to JDK1.3?

    Hi,
    I have some source code written in JDK1.0 and I'm currently trying to update it to JDK1.3 - there are a few classes which are deprecated, such as handleEvent and action.
    Updating these classes looks like it might be a bit difficult (im not a Java pro!), does anyone know if theres any software out there which can do this for me?
    Thanks!

    OK. I apologize.
    I don't think that such a tool exists, and I would probably not use one UNLESS I knew how to do it by hand myself.
    In general, anywhere you have a handleEvent you replace with an EventListener of some kind...
    I think the best way to learn a programming language is to engage in a project that is above you, and meet the challenge...
    ~David
    (I hope this was slightly more helpful than my last reply)

  • Trying to create a new movie.  It tells me to name my movie, and the only event choice is the last movie I made.  I don't want it there.  I'm lost and I'm just starting.  Not sure I like the new version.  Any help out there?

    I'm trying to create a new movie.  It tells me to name my movie, and the only event choice in the drop down menu is the last movie I made. IMovie Library is greyed out. I'm lost and I'm just starting.  Not sure I like the new version.  Any help out there?

    peggy818 wrote:
    … I'm lost and I'm just starting.  Not sure I like the new version.  …
    have a read in the Manual:
    http://help.apple.com/imovie/mac/10.0/?lang=en#mov755717b21

  • I can't open my imovie '9 projects on my new lap top which uses imovie 11'.. previous lap top was mac book osx 10.5.8.. new one is mac book pro 10.6.6.. any help out there! i'm pretty useless at this stuff, might be really simple???

    which uses imovie 11'.. previous lap top was mac book osx 10.5.8.. new one is mac book pro 10.6.6.. any help out there! i'm pretty useless at this stuff, might be really simple???

    Thanks for nothing, as usual, Apple.
    I had to redo the whole project from scratch on Windows Movie Maker.
    Now I know which brand to trust on my next purchase.

  • HT1657 trying to rent a movie on apple tv for the first time and can't do it without authorizing my computer on itunes store but can't find the menu on the iTunes site that lets me authorize my computer. any thoughts out there?

    trying to rent a movie on apple tv for the first time and have to authorize my computer but can't find the itunes menu that allows me to do this.  any thoughts out there? 

    If the computer's running Mac OS X, move the cursor to the very top of the computer's screen, click on Store, and choose Authorize this Computer.
    If the computer's running Windows, press the Alt and S keys and choose Authorize this Computer, or click here, follow the instructions, click on Store in the menu bar, and choose Authorize this Computer.
    (98261)

  • I restored my ipod touch however the apps will not sync.  I tried to re-download but I changed my apple id as my old id is no longer a valid email address.  Any ideas out there please

    I restored my ipod touch however the apps will not sync.  I tried to re-download but I changed my apple id as my old id is no longer a valid email address.  Any ideas out there please?

    It might be logical to someone, but not to me. I agree it's a pain.
    How did you change your Apple ID? Creating a new one is not what you want to do, but if you changed the ID associated with your purchases then that might have worked. You would need to sign in with the Apple ID on both your iPod Touch as well as in iTunes. I'm not sure how you changed it but clearly they need to match.
    If it's just your password that is not getting recognized reset it here: http://iforgot.apple.com/
    It will send an email confirmation to the email address associated with that Apple ID. The email address you elect to use might not look anything like your Apple ID. If you don't appear to get an email check your spam filter.

  • My ipod 4 when i plug it to my pc Windows 7 had worked fine for 8 months then one day i plug it in and a message came USB device not recognized, i tried reset network settings and nothing called apple they did not know any help out there TX

    My ipod 4 when i plug it to my pc Windows 7 had worked fine for 8 months then one day i plug it in and a message came USB device not recognized, i tried reset network settings and nothing i did not install any software before this happend i called apple they did not know, any help out there TX

    Start here:
    iPhone, iPad, or iPod touch: Device not recognized in iTunes for Windows

  • Every time I try to install itunes on my PC I get the following message, and I can't seem to find a solution. Any help out there?? "There is a problem with this Windows Installer package. A program required for this install to complete could not be run."

    Every time I try to install itunes on my PC I get the following message, and I can't seem to find a solution. Any help out there?? "There is a problem with this Windows Installer package. A program required for this install to complete could not be run."

    Try the following user tip:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

  • HT203175 When I try to open itunes i get a message saying: File "iTunes library.itl" cannot be read because it was created by a newer version of itunes. Any help out there?

    When I try to open itunes i get a message saying: File "iTunes library.itl" cannot be read because it was created by a newer version of itunes. And itunes will not start up. Any help out there?

    Hi did you ever get a solution to this problem? Having the same issue myself!

  • Every time I try to mirror my iPad 2 to my Apple TV it says "error has occurred try again later" any suggestions out there? Simply trying to watch what's on my iPad on my tv

    Every time I try to mirror my iPad 2 to my Apple TV it says "error has occurred try again later" any suggestions out there? Simply trying to watch what's on my iPad on my tv

    I would go over the wifi routers settings verifing that it does not block the required ports

  • I upgraded to lion when it first came out but today i tried to open my photoshop cs2 and its telling me the powerpc applications are no longer supported is there any fix out there for this

    i upgraded to lion when it first came out but today i tried to open my photoshop cs2 and its telling me the powerpc applications are no longer supported is there any fix out there for this

    Lion is Not compatible with PPC (Power PC) based software, such as your older version of PhotoShop.  Your choices are you can either upgrade to the newer version of PhotoShop, or you can backup your data and apps, erase your harddrive and reinstall Snow Leopard.
    Hope this helps

  • I have used Photoshop CS2 for over 5 years with Dimage A2 using the RAW forment, Now it will not work. Any answers out there? Thanks

    The Photoshop has always worked well with the Minolta DimAge A2 using the RAW format. Now, it will not.  Strange that Corel Paint Shop Pro X2 Ultimate works fine and cost less tha $100...  Any responses out there about that?

    They may know more in the Camera Raw forum.

  • I am having the  problem . it says it shouldnt take more than 3 minutes then i get this message Could not activate iphone. i have taken the sim card out and put it back in even then its of no use. if any one out there can help us it would be very nice

    i am having the  problem in my 3gs iphone. it says it shouldnt take more than 3 minutes then i get this message Could not activate iphone.
    i have taken the sim card out and put it back in even then its of no use.
    if any one out there can help us it would be very nice of them. thank you for your time.

    I can not get to iPhone screen, so no way to get to Settings. That is the problem. When I connect phone to iTunes I get screen asking to insert SIN card. On the phone I'm getting Cinfigure screen asking Launguage , Country or Region, Wi-Fi, ( I can connect to my home wi-fi), and last screen "Activating your iPhone". After two minutes of waiting IM getting message: Your iPhone could not be activated because the activation server in temporary unavailable. try connecting to iTunes or try later or contat apple.com/support.
    Like I mention, I went to Bell as well Rogers store and tried to insert active SIM card with no results.
    Yes, my friend unlock the phone to use with Rogers but I don't know where

Maybe you are looking for

  • TS1413 Ihave OX S Snow Leopard 10.5.8 and can't upgrade - any ideas how?

    I t appears that Apple does not support an upgrade from OX S Snow Leopard 10.5.8 to OX S 10.6 which means I am unable to upgrade to any higher versions such a mountain lion, etc. Does anyone know I there is anything available that would help me move

  • Gaming Precautions with Early 2008 MB

    Hey Everybody! I had a couple questions that I can't seem to find definitive answers to anywhere else concerning playing games on my 2008 2.4 GHZ 2 GB 13' MB. I've used it mostly for school, music, photos, and movies, so playing games is a whole new

  • Question about POWL in Travel Management

    Greetings! currently, we are in the process of implementing SAP Travel Management on our DEV System (Request and Expenses) and therefore of designing business processes. One major crucial point is the process of Approving the Travel Request. We are o

  • Saving an Illustrator file as a jpg

    I'm trying to save an Illustrator file as a jpg, but when I exported it, the image quality was so horrible. I created an alphabet and there was plenty of space in the margins on the artboard, but in the jpg image, some of the letters are cut off and

  • ICM DIstributor service & data base update fail

    Hi Friends, I am unable to start ICM distributor service. getting error 1069: the service did not start due to logon failure. now I have restart the service with local but I am unable to change agents password and not able to create new agent id. it