Divide a string in order to get the distinct list level.

Hi,
I want to divide a string in order to get the distinct list level to relate this with a category table.
The size of my list is dynamic and because of this I’m unable to find a way to do this!
Here goes an example of what I need to do:
Consider the following list:
Category                Category_ID
Age                     1
Less than 3 months      1.1
Less than 9 months      1.2
Less than 1 year        1.3
Risk                    2
Danger                  2.1
High                    2.1.1
medium                  2.1.2
low                     2.1.3
If I have a row that has category_id "2.1.3" I want to present values as:
"Risk.Danger.Low"
If I have a row that has category_id "1.1" I want to present values as:
"Age.Less than 3 months"Any hint on what I should search in order to accomplish this?
This will be used to produce a report. This report will contain a few thousand rows and the categories will be around 100.
Thanks,
Ricardo

Hello
I think this is a job for sys_connect_by_path....
with p as
(   select 'Age'             descr  ,'1' cat from dual union all
   select 'Less than 3 months'      ,'1.1' cat from dual UNION ALL
   select 'Less than 9 months'      ,'1.2' cat from dual union all
   select 'Less than 1 year'        ,'1.3' cat from dual union all
   select 'Risk'                    ,'2' cat from dual union all
   select 'Danger'                  ,'2.1' cat from dual union all
   select 'High'                    ,'2.1.1' cat from dual union all
   select 'medium'                  ,'2.1.2' cat from dual union all
   select 'low'                     ,'2.1.3' cat from dual
SELECT
    cat,
    LTRIM(SYS_CONNECT_BY_PATH(descr,'.'),'.') route
FROM
        SELECT
            descr,
            cat,
            SUBSTR(cat,1,INSTR(cat,'.',-1)-1) parent
        FROM
            p
START WITH
    parent IS NULL
CONNECT BY
    PRIOR cat = parent
SQL> with p as
  2  (   select 'Age'             descr  ,'1' cat from dual union all
  3     select 'Less than 3 months'      ,'1.1' cat from dual UNION ALL
  4     select 'Less than 9 months'      ,'1.2' cat from dual union all
  5     select 'Less than 1 year'        ,'1.3' cat from dual union all
  6     select 'Risk'                    ,'2' cat from dual union all
  7     select 'Danger'                  ,'2.1' cat from dual union all
  8     select 'High'                    ,'2.1.1' cat from dual union all
  9     select 'medium'                  ,'2.1.2' cat from dual union all
10     select 'low'                     ,'2.1.3' cat from dual
11  )
12  SELECT
13      cat,
14      LTRIM(SYS_CONNECT_BY_PATH(descr,'.'),'.') route
15  FROM
16      (
17          SELECT
18              descr,
19              cat,
20              SUBSTR(cat,1,INSTR(cat,'.',-1)-1) parent
21          FROM
22              p
23      )
24  START WITH
25      parent IS NULL
26  CONNECT BY
27      PRIOR cat = parent
28  /
CAT   ROUTE
1     Age
1.1   Age.Less than 3 months
1.2   Age.Less than 9 months
1.3   Age.Less than 1 year
2     Risk
2.1   Risk.Danger
2.1.1 Risk.Danger.High
2.1.2 Risk.Danger.medium
2.1.3 Risk.Danger.lowHTH
David
Edited by: Bravid on Sep 2, 2011 2:50 PM

Similar Messages

  • I recieved an Adobe Master Collection License number from my school (Stevens Institute of Technology) and I can't figure out how to use it in order to get the product. I've created a username and that's as far as I've gotten.

    I recieved an Adobe Master Collection License number from my school (Stevens Institute of Technology) and I can't figure out how to use it in order to get the product. I've created a username and that's as far as I've gotten. I need to download the product and I can't figure out where to begin.

    Ask someone at your school... Do you have a Cloud redemption code, or a CS6 serial number?
    If Cloud, Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html and
    http://www.adobe.com/products/creativecloud/faq.html
    http://helpx.adobe.com/creative-cloud/help/install-apps.html to install or uninstall
    http://forums.adobe.com/community/download_install_setup/creative_cloud_faq
    What it is http://helpx.adobe.com/creative-cloud/help/creative-cloud-desktop.html
    Cloud Getting Started https://helpx.adobe.com/creative-cloud.html
    If CS6, download at Other downloads and enter your serial number when prompted
    Again... your 1st resource is your school

  • When bookmarking a page, I can't get the complete list of bookmark folders to dropdown in order to select any folder in which to bookmark page. What do you set to get whole list of folders in Bookmarks to drop down?

    When bookmarking a page, I can't get the complete list of bookmark folders to drop down in order to select any folder in which to bookmark page. The 'Folder:' bar has 'Bookmarks Menu' showing. The arrow on the bar drops down 5 recent folders to which pages have been saved, but the pop down arrow to the right of the bar just opens to show the three categories and 'New Folder' button. What do you set to get whole list of folders in Bookmarks to drop down?

    To all, embarrassingly enough, I have discovered that I didn't know how to expand the three categories including 'Bookmarks Menu' in the 'Bookmark This Page' pop up interface. It was expanded by default on the initial Firefox opening and first page bookmark attempt. Next use it only showed categories. I clicked and double clicked the 'Bookmarks Menu' line, but failed to see the small, shaded triangle used to expand/collapse list. If it appears collapsed, just tap triangle at left of line to see all folders. It seems to open the same way after I do it for first time. Sorry for the inconvenience, and thanks for all the attempts to help.

  • How can I get the key list in ......

    The code such as UIManager.getColor("Table.selectionForeground") can get the default color of swing components,however,how I can get the key list on a swing component?
    Thanks a lot!

    Hello,
    you can get whole list withjava.util.Enumeration keys = UIManager.getDefaults().keys();
         java.util.Enumeration values = UIManager.getDefaults().elements();
         while (keys.hasMoreElements()){
              System.out.println("Key: "+keys.nextElement());
              System.out.println("Value: "+values.nextElement()+"\n");
         }search for special components.
    regards,
    Tim

  • HT204053 How can I get the contacts list on my iPhone to appear in my iPad Air

    How can I get the contact list on my iPhone to appear in my iPad Air?

    Welcome to the Apple Community.
    Please try the following…
    First check that all your settings are correct, that contact syncing is checked on all devices (system preferences > iCloud on a mac and settings > iCloud on a iPhone, iPad or iPod).
    Make sure the contacts you are adding are added to your 'iCloud' group and not an 'On My Mac', 'On My Phone' or other non iCloud group (you can do this by checking in groups), non iCloud contacts will not sync.
    If you are sure that everything is set up correctly and your contacts are in the iCloud group, you might try unchecking contact syncing in the iCloud settings, restarting your device and then re-enabling contact syncing.

  • Get the file list of a given directory

    does anyone know how to get the file list of a given directory? I tried "list"/"filelist" but the class not found.
    THanks!

    What made you assume that there exist classes called list or filelist etc.
    Do you read API documentation etc ?
    Anyways, here is a hint java.io.File.listFiles()

  • How to get the users list that can Add/Remove or modify Vendors in Oracle?

    How to get the users list that can Add/Remove or modify Vendors in Oracle?
    I need to generate a report like name and responsibility. Thanks

    That query gives the Supplier information.
    But what i would be needing is to find out the USERS in oracle who can Add/Modify or Remove Vendors.
    I assume it should be based on the Responsibility.

  • How to get the initdefault run level in Solaris 10

    Hi All,
    In Solaris 9 and below
    I will get the init run-level by checking the /etc/inittab entry
    is:3:initdefault:
    But in Solaris 10 we are using the smf functionality.
    Here how I can get the init default run level.
    Please help me in this problem.
    Regards,
    Kalai

    Init levels no longer form a 1:1 mapping with how SMF will run things.
    The default milestone is 'all'. You can override this on the boot line. I'm not sure how you might change it within the filesystem.
    Darren

  • How do you get the bookmarks list permanently displayed on the left side of the screen?

    I somehow managed to get the bookmarks permanently open and displayed in a vertical column on the left side of the screen. I accidentally closed it and cannot get it to display again. How do you manage to get the bookmark list permanently open and displayed again? Thank you.

    Hello exoticdoc2, see if the next [https://addons.mozilla.org/en-us/firefox/addon/all-in-one-sidebar/ All-in-One Sidebar add-on] it is useful for you, it is more than a sidebar bookmarks toolbar.
    thank you

  • Is it possible to get the current output level??

    Is it possible to get the audio output level of a stream (in this case a mic input going through GSM compression to an RTP socket).
    I would like a couple of volume bars in my application so people can see how loudly they are talking.
    If anyone has any ideas on how to achieve this it would be much appreciated!
    Thanks,
    Dex

    You want a volumeter, i am also interesting in it

  • Where can I get the full list of features and details of v28

    Where can I get the full list of features and details of v28, I searched alot but could not find the official list of features.

    try this:
    http://helpx.adobe.com/digital-publishing-suite/help/whats-new-release.html

  • Getting the distinct person or group column from a splist

    Hi,
    I am trying to get a distinct user type column from my splist. customerUserID is my column name which of type "Person or Group".
    I am having multiple entries in my splist. i want to pas  my curentoggedinuser and compare it against the values from the "customerUserID".
     i tried  using the linq ,but it fails.
    can someone pls help whats the code i need to try.
    DataTable dt = items.GetDataTable();
    DataView dtview = new DataView(dt);
    DataTable dtdistinct = dtview.ToTable(true, "customerUserID");
    bool exists = dtdistinct.Select().ToList().Exists(row => row["customerUserID"].ToString().ToUpper().Equals(SPContext.Current.Web.CurrentUser.LoginName.ToString()));
    if (exists == true ) break;
    am trying teh above code,but i am unable to get the distinct value[ i need only one record ].
    but the above doesnt evaluate to true , eventhough ia m having the correct values in my splist.
    Das

    Hi,
    Please refer to the following blog
    https://rmanimaran.wordpress.com/2011/05/20/get-distinct-values-from-a-sharepoint-list-along-with-where-condition/
    Please don't forget to mark it answered, if your problem resolved or helpful.

  • Urgent: Want to get the directory listing

    Hi,
    My iAS and iWS reside on separate unix machines.
    My pdf files being a static content reside on iWS.
    My application which is deployed on iAS, wants to
    know the names of the pdf files residing on iWS.
    Can anyone tell me, as to whether there is any way
    for an application deployed on iAS to get the directory
    listing of files residing on a separate machine.
    Is there any API which will be of help ?.
    I guess there must be some APIs associated with the
    web connector installed on the machine where iWS is installed.
    Regards,
    Amar.

    <i>Can anyone tell me, as to whether there is any way
    for an application deployed on iAS to get the directory
    listing of files residing on a separate machine.</i>
    No. More specifically, the appserver doesn't have any special awareness of external filesystems. (The webconnector does not have any API's that would expose the webserver's files. That would be a huge security violation.)
    You could always NFS mount the webserver so that the appserver could see it. This has some security concerns, but you are going to have security concerns anytime that you are exposing your webserver's files directly.

  • Can I get the tab's(Level 1 menus) invoke function's URL and parameters

    Hi,
    Can I get the tab's(Level 1 menus) invoke function's URL and parameters in CO?
    Not just the tab being seleced,All the tab's nvoke function's URL.
    Thanks,
    binghao

    I got it.use OALinkBean's method getDestination()

  • How can I get the font list of local

    Hi, everyone.
    In AS2.0, I can use TextField.getFontList() to return a
    array that include all font family of local.
    However, AS3.0 no longer supports it. How can I get the font
    list of local in AS3.0?
    Thanks

    thanks, I have been found result from adobe livedocs.
    example code following:

Maybe you are looking for

  • Working around iCal alarm failure.

    Although I really like iCal, I gave up using it because alarms don't work if iCal is not turned on. The other day, I had a minor inspiration! I set iCal to turn on automatically, whenever I logged on. Thus, I get any overdue reminders immediately aft

  • Using a laptop and Pc to transfer my music.

    I have my main music downloaded to my pc and want transfer the songs and the titles over to my lap top. If burned a cd and copied it to the lap top but it doesn't show the song titles. How can I share both my pc and laptop with my ipod?

  • Util.dbping error

    I am using: java utils.dbping ORACLE user pass dbname get the following error: Missing license file for: WebLogic Server 6.1 Error encountered: java.sql.SQLException: Fail to load jDriver/Oracle due to license checking faile d! at weblogic.jdbc.oci.D

  • Keeps trying to installing GarageBand

    Hello, I have just bought GarageBand from the App Store. However after I downloaded the 1.6GB download, I then click on the GarageBand Icon it then starts to re-download the app even though it has already downloaded it? Hope you can help. Ed.

  • Help please!  Urgent!  How do I restore my computer to factory settings?

    I got a potential buyer for my macbook pro because I'm selling to buy a Mac Pro. Anyway, he wants to pick up the computer in an hour and a half. I need to restore the computer to factory settings WHILE ALSO getting Windows XP off of this computer and