Tree of market - how to give link only to the lowest

Hello


Are my data table and model to model;
CREATE TABLE CODE_HIERARCHY
(
  PARENT_CODE  VARCHAR2(255 BYTE)                   NULL,
  CHILD_CODE   VARCHAR2(255 BYTE)                   NULL
);

Insert into CODE_HIERARCHY
   (PARENT_CODE, CHILD_CODE)
 Values
   ('KING', 'DUKE');
Insert into CODE_HIERARCHY
   (PARENT_CODE, CHILD_CODE)
 Values
   ('DUKE', 'LORD');
Insert into CODE_HIERARCHY
   (PARENT_CODE, CHILD_CODE)
 Values
   ('LORD', 'PEASANT');
Insert into CODE_HIERARCHY
   (PARENT_CODE, CHILD_CODE)
 Values
   ('KING', 'BUSINESS MAN');
Insert into CODE_HIERARCHY
   (CHILD_CODE)
 Values
   ('FREEMAN');
Insert into CODE_HIERARCHY
   (PARENT_CODE)
 Values
   ('HERMETIC');
COMMIT;
My desired output is such that each parent is only displayed with the lowest child through the links and any parent childless is not displayed, but a child without parents.

It is therefore my output desired, although the order of the data, I am not concerned about; -
Parent_Code     Child_Code
KING                PEASANT
KING                BUSINESS MAN
                      FREEMAN
DUKE              PEASANT
LORD              PEASANT
Someone tell me how please, I experimented and connect, but I do not get the result I want.

I'm on 9i DB, but access to GR 11, 2 also - the two versions of the solution - if different - are good.


With our thanks,


Robert.

Hello

As said Hoek, in Oracle 10 (and more), you can use CONNECT_BY_ISLEAF:

SELECT     CONNECT_BY_ROOT     parent_code          AS parent_code
,     child_code
FROM     code_hierarchy
WHERE     CONNECT_BY_ISLEAF     = 1
START WITH     child_code     IS NOT NULL
CONNECT BY     parent_code     = PRIOR child_code
;

Oracle 9 is not CONNECT_BY_ISLEAF. You can use a subquery.
Oracle 9 does not CONNECT_BY_ROOT, either, but you can get the same information using SYS_CONNECT_BY_PATH, like this:

WITH     got_path     AS
(
     SELECT     SUBSTR ( SYS_CONNECT_BY_PATH (parent_code, '/') || '/'
                 , 2
                 )     AS path
     ,     child_code
     FROM     code_hierarchy
     START WITH     child_code     IS NOT NULL
     CONNECT BY     parent_code     = PRIOR child_code
)
SELECT     SUBSTR ( path
            , 1
            , INSTR (path, '/') - 1
            )                  AS parent_code
,     child_code
FROM     got_path    p
WHERE     child_code  NOT IN (
                          SELECT  parent_code
                      FROM    code_hierarchy
                      WHERE   parent_code     IS NOT NULL
                      )
;

Tags: Database

Similar Questions

  • How to give full access to the port to laptop

    Hello! I need help.
    I get data using xbee connected to the port of the laptop. The problem is with the increase of baud rate, time of receipt does not increase as it is.
    My instructor told me that your com port does not provide complete space to your software (LabVIEW). My question is how to give full access to the com port to LabVIEW? Kindly help...

    Here's my vi... I put the 115200.But baud rate in labview so I get the data and it intrigues, it traces precisely after 8 seconds. But I put the shipment time less than 8 seconds, it does not trace accurately.

  • How to give administrative rights for the domain users (user is outside organization).

    Hello

    How to give administrative rights for the domain users (user is outside organization).

    If the employee works in the company of xxxx but it supports the client project and is located on the place of the customer, but it does not use the client computer and not on the client domain as well, but the employee is in the company of xxxx must be given administrative rights to the computer. can someone help me on this ASAP.

    Thank you

    MURUGESAN Rudy,

    This issue is beyond the scope of this site and to make sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
  • How to copy link to display the text in the Clipboard in the iphone?

    Situation: I get an email of delivery notification to an online store with the clickable link that displays the tracking number.

    Example: I see a link with the text "1zA56300" which is my tracking number.

    What I want to do is to select the text to display link, copy it and paste it into my shipment tracking application (I use the app delivery) to allow the application to track packages. However, my iPhone copy the URL instead of the tracking number.

    For example: copy the url http://shippingcompany.com/reallylonglink to the Clipboard. The request of delivery cannot analyze this link is useless to me.

    Is there a way to have the Apple mail for iOS copies the text that is displayed on the screen instead of the underlying URL?

    Hello AxeBox360,

    Thank you for using communities Support from Apple!

    Looks like you want to copy the text of a link rather than the link itself.  Be able to copy and paste what you need can save a lot of extra keys and helps to ensure accuracy.

    To copy the text, rather than the underlying connection, is to tap on the word before or after the link, select copy, and then move the selector so that it contains the text of the link.  This will then copy the text and not the underlying link and allows you to paste the text where you need.

    See you soon!

  • How to give read access to the users in IOM 10 g only

    Hello
    I created a new group readonlyaccess in IOM 10 g. I have given-menu item 'Element menu to manage users' group. Dmade a user member of this group. Now when I login with this user, I am able to see the users menu-search item, but when I search users, then no results of the search are displayed. I'm not able to figure out where I am doing wrong or what Miss me.


    Please let me know if we can give only read access for end-users to IOM 10 g.


    Thank you
    Kalpana.

    Refer to this:

    {: identifier of the thread = 2148294}

    -Marie

  • How to give some access to the system without giving local administrator access?

    Hello

    I'm looking for advice on how I can accomplish the following tasks without giving certain groups of rights of a local administrator on the server.

    • Ability to query the status of all Windows Services
    • Access WMI
    • Ability to read all the event logs
    • Ability of the State to the query of all services
    • Activation of remote PowerShell commands

    I need to give this kind of access to the servers are Windows Server 2008 R2, Windows Server 2008 Std Edition and Windows Server 2003.

    Advice and guidance would be greatly appreciated.

    Thanks in advance.

    Hello

    The question you have posted is better suited for the TechNet forums. Please post your question here.

    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer

  • BoolText.text how to give several channels (on the text and off text)

    How can I automatically change the text 'on' and 'Off' a Boolean value text. In the node property, I found BoolText.Text but how to use it to give power and text turn off? Thank you

    Hi TDE_CH,

    You can use the property '[4] Strings' to define these texts or you right-click on your control and use the Properties dialog box to change it.

    Mike

  • How to give users access to the database schema?

    I have the following databases:

    Running test of Oracle9i Enterprise Edition Release 9.2.0.6.0
    Production is currently running Oracle9i Enterprise Edition Release 9.2.0.7.0

    I created a user at the same time and on the production side, it works fine, but on the side of test, I get ORA-1017: name of user and password invalid. connection refused when I try to connect via my web application or when I try through sql more is not log to the side test but does for the Pb of the production.

    How can I compare two users?
    During the creation of my table, procedure, etc. scripts, I have granted access this even sure if the user has rights to the tables and other objects.

    There is another main user account that is able to do everything that I need so I know it's possible, but need me something to allow my new user to connect.

    Thanks for any help you can give me.

    Published by: jerry8989 on March 16, 2012 08:10

    jerry8989 wrote:
    I have the following databases:

    Running test of Oracle9i Enterprise Edition Release 9.2.0.6.0
    Production is currently running Oracle9i Enterprise Edition Release 9.2.0.7.0

    I created a user at the same time and on the production side, it works fine, but on the side of test, I get ORA-1017: name of user and password invalid. connection refused when I try to connect via my web application or when I try through sql more is not log to the side test but does for the Pb of the production.

    How can I compare two users?
    During the creation of my table, procedure, etc. scripts, I have granted access this even sure if the user has rights to the tables and other objects.

    There is another main user account that is able to do everything that I need so I know it's possible, but need me something to allow my new user to connect.

    Thanks for any help you can give me.

    Published by: jerry8989 on March 16, 2012 08:10

    "ORA-1017: name of user and password invalid; connection refused '.

    Oracle is too easy to lie about it. It has noting to do with what privileges you have given to the user. There is never far enough to worry about privileges. Either you provide a user name does not exist, or you provide the wrong password for this user name. Period.

  • How to give multiple entries in the process BPEL syn in Jdeveloper

    Hello

    I'm new to BPEL. I have created programs that takes only one input and after treatment poster single output. I would like to make a contribution of more than one runtime (for the name of the employee e.g., age, salary) and want to view multiple output after their treatment instead of just I am doing now. How can I do this by using synchronous BPEL process. Can you tell what will learn time for BPEL using google and the forums, for a person to 3 years in JAVA and new on BPEL exeperienced.

    Yogendra Rishishwar

    Hello

    You just need to change the XSD in your process.

    Someone posted something similar last week: How to change the entry and exit of BPEL process diagram

    Hope this will help you...

    Roman.

  • How many masters link can save the LAS primaries?

    I have 10 device on a network FFB HI, 7 of them can be masters of link. Should I put all 7 link masters to save LAS primaries?

    Hello

    There is no limit to the number of backup LAS primary school.

    And otherwise, the master device to link with the address smaller LAS primary school.

    So please change your device address this rule.

  • How can I search only in the forum of the xoom?

    wwhen I'm looking on the forum of the xoom, it has topics on other devices, xoom not only. Not good

    When you start typing in the box search a drop down appears. at the top right, you can click Search xoom only.

  • How to give a name to the new (created as an extension) actionset in a vSphere of existing objects (say HostSystem)?

    Hello world

    I am trying to create the new context menu for vCenter Web Client Plugin under HostSystem object. I created actionset extension according to the lines form guidelines here.

    I had the context menu under the name of "All the Actions of noGroup" (see the following image):

    Actionset-Extension.png

    I want to change 'All the Actions noGroup' to the ' stock My_Plug-in_Name. Is this possible? and if so, how?

    -Thanks in advance.

    Lee.

    Received the response here form:

    Re: A question about the creation of extensions of the action

    > The node is always displayed "all the Actions of noGroup".

    This is because you are running in mode of development, and not with a packaged plugin.

    There is an explanation in the FAQ that comes with the SDK documentation, see "Menu shows"All the Actions of noGroup"

    Documentation of the FAQ:

  • How to include Web only in the custom web viewer

    Hi, I have published "renditions" folio iPad being incorporated in a web viewer customized on the website of the company. I created a Web rendering only in order that it appears in the web viewer custom, but rendering of the iPad, it's what always incorporates. It seems that the Web don't watch on the Adobe viewer welcomed Web, not the company site. Is there a different URL to the Web only folio I should use? Where can I find that? Thank you.

    Hi, have confirmed the account where you created a web only rendering has the URL hosting on the Administration page accounts? I wonder if he this interpretation was created using a separate account. In case you haven't seen the devnet article on the web viewer configuring integrated, it's here.

    I'll you private message for more information.

    Thank you

    Brian

  • How do I link again in the world of all pages to the new index?

    Hello

    Using DW 8 had a clue whose page I changed the name of indexlayers and who updated all pages of course with have how to tie all my pages to a new page I just called "index"? I need a global re-edit, but how do I do it?

    Thank you very much
    KO

    Change the name of the index to the index-z. Then change the name to indexlayers to
    the index. Then change the name of xindex AND REFUSE TO UPDATE PAGE index.
    Then replace a - z index indexes.

    Bada bing, bada boom.

    Or do a find at the site level and replace to search for all instances of "indexlayers".
    to "index".

    --
    Murray - ICQ 71997575
    Adobe Community Expert
    (If you * MUST * write me, don't don't LAUGH when you do!)
    ==================
    http://www.dreamweavermx-templates.com - template Triage!
    http://www.projectseven.com/go - DW FAQs, tutorials & resources
    http://www.dwfaq.com - DW FAQs, tutorials & resources
    http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
    ==================

    "iwics2" wrote in message
    News:e9r8am$AA8$1@forums. Macromedia.com...
    > Hello
    >
    > Using DW 8 had a clue whose page I changed the name to indexlayers and
    > who
    > updated all pages have of course with how to tie all my pages to a
    > new
    > page I simply called "index"? I need a global re-edit, but how do I do it?
    >
    > Thank you very much
    > KB
    >

  • Qosmio G30: How can I install only of the recovery image Ulead Dvd Movie factory

    Hello world

    I have question about Ulead dvd movie factory.
    First of all, I bought my G30 with XP when it was time to offer "vista for a few euros.

    So, I installed Vista with the official CD of Toshiba. But he was more Ulead Dvd movie Factory. The XP is just a disk image restore CD, I can't install it.

    Does anyone have a solution for me?
    Thank you to.
    ARM

    I think there is a solution!
    I found the Ulead DVD Movie Factory utility on the page of Toshiba.

    I searched the area of Qosmio G30 but without to succeed.

    But I checked the other sections and selected Satellite Satellite A series Satellite A200 (PSAEC) Vista and found the version of Ulead DVD Movie Factory 5.51.0147.03

    Download a trial to install this tool.

    Need factory!

Maybe you are looking for