All the supervisor for a SQL Oracle employee hierarchy

Hello


We can print any employee hierarchy for each employee using oracle SQL hierarchical query. PFB to the data table and exit examples that I need.


Example of employee table

EMPIDENAMEMGRID
1A1
2B1
3C2
4D2
5E3

Example of output

EMPIDENAMEHierarchy
1A-
2B/ 1
3C/ 1/2
4D/ 1/2
5E/ 1/2/3

Thanks in advance.

You can use the hierarchical query

SQL> select empno, ename, sys_connect_by_path(nvl(to_char(mgr), 'BOSS'), '/') mgr_list
  2    from emp
  3  start with mgr is null
  4  connect by prior empno =  mgr;

     EMPNO ENAME  MGR_LIST
---------- ------ --------------------------------------------------
      7839 KING   /BOSS
      7566 JONES  /BOSS/7839
      7788 SCOTT  /BOSS/7839/7566
      7876 ADAMS  /BOSS/7839/7566/7788
      7698 BLAKE  /BOSS/7839
      7499 ALLEN  /BOSS/7839/7698
      7521 WARD   /BOSS/7839/7698
      7654 MARTIN /BOSS/7839/7698
      7844 TURNER /BOSS/7839/7698
      7782 CLARK  /BOSS/7839

10 rows selected.

Tags: Database

Similar Questions

  • How do to know all the tables on peoplesoft (on Oracle 8.1) with data

    I need to know all the tables on peoplesoft (on Oracle 8.1) < strong > with < facilities > data
    and ignore the tables without data.

    It takes to write a pl/sql procedure or is there an easy solution?
    I wrote an example of code, but I am disconnected programming
    for the long and I need help.
    Thanks in advance
    Pls answer
    _______________
    Cursosr curtab is select table_name from dba_tables;
    curtab() loop
    Select count (*) x from curtab;
    If x & gt; 0
    UTL_FILE. Write ('curtab')
    on the other
    null;
    endif;
    end loop;
    ____________________

    Julia wrote:
    I need to know all the tables on peoplesoft (on Oracle 8.1) with data
    > & ignore tables without data.
    >
    > It takes to write a pl/sql procedure or is there an easy solution?
    > I wrote a code example, but I am disconnected programming
    > for a long time and I need help.
    > Thanks in advance
    > Pls answer
    > _______________
    > Cursosr curtab is select table_name from dba_tables;
    > curtab() loop
    > select count (*) x from curtab;
    > If x > 0
    > utl_file.write ('curtab')
    > other
    > null;
    > endif;
    > end of loop;
    > ____________________

    Consider using the user_tables and it works the relevant schema rather than dba_tables breast or of all_tables as these allows you to specify the schema name too will require.

    set serveroutput on;
    
    DECLARE
      cursor curtab is
        select table_name
        from   user_tables;
      --from   all_tables where owner = '';
      v_cnt NUMBER;
    BEGIN
      FOR t IN curtab
      LOOP
        EXECUTE IMMEDIATE 'select count(*) from '||t.table_name INTO v_cnt;
        IF v_cnt > 0 THEN
          DBMS_OUTPUT.PUT_LINE(t.table_name);
        END IF;
      END LOOP;
    END;
    /
    

    Or...

    Ensure that statistics were collected for the schema and examine the value of num_rows in the user_tables view. ;)

  • I have the time to default iPhone 4 iOS 7.1.2 iPhone App not updated since the last 3 days and also checked all the settings for location and also set as new iPhone always present problem... Please try to fix... Thanx

    I have the time to default iPhone 4 iOS 7.1.2 iPhone App not updated since the last 3 days and also checked all the settings for location and also set as new iPhone always present problem... Please try to fix... Thanx

    Turn off your device and turn it on again. If this does not help, sign out of your account and reconnect.

    In addition, you can try to reset your settings.

    • Press and hold the sleep/wake button
    • Press and hold the Home button
    • Press and hold both buttons until the display turns off and on again with the Apple logo on the subject.

    Alternatively, you can go to settings - general - reset - Reset all settings

  • Where can I find all the drivers for Tecra 8200

    Where can I find all the drivers for a Toshiba tecra 8200 PIII750/20/14 t/D/LM/W - I searched for drivers (all drivers) this Labtop can enyone please help me :)

    Got Windows XP:

    Post edited by: Rullings

    Hello

    Have you checked the European driver Toshiba page?
    This site contains all the necessary drivers for Win95, Win98, Win98SE, Win XP, ME, W2k.

    Only Vista drivers are not available for this oldie

    Check it!

  • 152TX HP - AC: I need all the drivers for my laptop hp 8.1 windows

    Hi guys,.

    Can some1 please help me get all the drivers for my system. I installed windows 8.1 in my laptop.

    Thank you!

    Kind regards

    Prashant

    Hello:

    You should be able to use the W8.1 drivers and software ac000-15 t on your model, except the BIOS and firmware files.

    http://support.HP.com/us-en/drivers/selfservice/HP-15-ac000-notebook-PC-series/7771404/model/8381866

    Using the latest graphics driver Intel appearing... sp72651

    Use the Realtek drivers wireless and bluetooth.

  • All the driver for Hp Pavilion 15 - n213sx windows 7 &amp; 8.1

    Please all the driver for Hp Pavilion 15 - n213sx windows 7 & 8.1

    HP provides a limited number of drivers for Windows 7 and the complete assortment of Windows 8.1 drivers on the page of drivers PC laptop HP Pavilion 15-n213sx.

    Please message the Windows Device Manager (text only) "Hardware ID" of all remaining missing or unknown devices, as shown in the example below.

    If you have any other questions, feel free to ask.

    Please click the 'Thumbs Up' white LAURELS to show your appreciation

  • I've implemented all the information for an email from the Charter and then when I click on get mail, it says there is a connection to the server error... Why?

    I've implemented all the information for an email from the Charter and then when I click on get mail, it says there is a connection to the server error... Why?

    Hello ChevyDriver10,

    Thanks for your post.  What email app do you use to receive your mail?

    In the meantime, take a look at the Charter of General electronic installation instructions.

    If you do not currently have an e-mail client, feel free to go on Windows Live Mail.

    See you soon

  • Write delay failed unable to save all the data for the file $Mft

    Have a frustrating problem.  Help is greatly appreciated.  Learned the hard way and lost a dwg important issue which was unrecoverable.  Bought a new drive external hard seagate.  Could not back up the entire system with software pre-installed.  Download acronis true image home 2011.  Tried to backup system.  Receive error when trying to backup messages; 'Delay to failure of Scripture; Reading of the sector; Windows was unable to save all the data for the file $Mft. The data has been lost.  Have tried many fixes.  Unable to disable write caching method (grayed out / unclickable).  Played regedit 'EnableOplocks' is not listed to select.  Attempted to run microsoft 'fix it' and got the blue screen of death.  Short hair out of my head.  Suggestions appreciated.

    I don't know where Microsoft 'Technical support engineers' get their information.

    Write caching without a doubt "does apply to external hard drives", but it is usually disabled to prevent to sort the problem you are experiencing.

    I've seen several positions reporting to the same question that you do.  All of these positions were with SATA drives.  Is your Seagate eSATA drive?

    The disc is recognized as an external drive in Device Manager?  In Device Manager, go to the drive properties dialog box and click the policies tab.  An external drive should have two options: "Optimize for quick removal" and "Optimize for performance".  An internal hard drive shows the options as gray (with 'performance' selected), but there should also be a checkbox "Enable disk write cache" under the second option.

    What shows in your policies tab?

    If I understand correctly, "writeback" or "write behind" is implemented by disc material or its pilot.  If the option is not available on the drive properties > policies tab, I would suggest to contact Seagate support.

  • All the drivers for P531H-1791?

    Can someone give me the link for all the drivers for the Aspire One P531H-1791 please?

    Concerning

    Mi32

    Hello

    Aspire One P531H = AOP531h

    You will find all the drivers for your netbook here. Select the operating system installed.

  • I tried all the steps for the error 646, but nothing works.

    Original title: samanthaddzt

    I tried all the steps for the error 646, but nothing works.

    What can I do?

    Have you tried this one from Microsoft Support?

    You receive the error code: 0 x 80070646, error code: 646 or error code: 1606 when using Windows Update or Microsoft Update

    http://support.Microsoft.com/kb/2258121

  • HP Pavilion n072sy-15 Notebook PC - where to find all the drivers for Windows XP and Windows 7

    Who knows where to find all the drivers for Windows XP and Windows 7 for HP Pavilion n072sy-15 Notebook PC?

    Hello:

    XP will not install or run on a PC with an Intel 8 series chipset, so you need not be concerned with finding drivers.

    Here is the link to a template that you can use the W7 x 64 bit drivers from.

    When you install the graphics drivers, first install the Intel HD graphics driver, reboot and then install the graphics driver nVidia.

    DO NOT USE ALL DOWNLOADS OF BIOS OR FIRMWARE FROM THIS LINK

    http://h10025.www1.HP.com/ewfrf/wc/softwareCategory?OS=4063&LC=en&cc=us&DLC=en&sw_lang=&product=6521374

  • Photosmart 7510 - I want to use only black ink since I don't have all the need for a color.

    Photosmart 7510 - I want to use only black ink since I mainly use this for work and don't have all the need for a color. If I have more ink, can I just replace the black and it still work? Thank you very much for any information you may have!

    Hello

    I did a few test last year, you can print black only master always need color ink for the printer. Black setting only as a default printer will only print black and it consumes a little over heating of the process color inks. In short, it will not be printed correctly when run out of color ink (s) or does not start at all.

    Kind regards.

  • How can I get all the options for the creation of new titles? I'm stuck on a Board where it does not color or width/size options

    How can I get all the options for the creation of new titles? I'm stuck on a Board where it does not color or width/size options

    If you have not all panels in the Titler then go and reset the current workspace that is located under the window.

  • For all the records for each record double, I need to get a single column with null or 0.

    Hi all

    I have a requirement where I need to get all the records, for each record in double, I need to get a single column with null or 0.

    create table a1

    (

    Identification number,

    VARCHAR2 (100), the point

    part varchar2 (100));

    Insert into a1

    values (1, 'ABC', 'A1');

    Insert into a1

    values (2, 'DEF', 'A2');

    TABLE A

    PART ITEM ID

    1 ABC A1

    1 ABC A1

    1 ABC A1

    DEF 2 A2

    DEF 2 A2

    3 DEF A2

    O/P

    PART ITEM ID

    1 ABC A1

    1        ABC             0

    1        ABC             0

    DEF 2 A2

    2       DEF              0

    3       DEF              0

    Thanks in advance.

    Thanks for your help FrankKalush...

    This one will work.

    WITH got_r_num AS

    (

    SELECT NVL (a1.id, a1.id) as id

    NVL (a1.item, a1.item) AS element

    NVL (a1.part, a1.part) IN the framework

    a1.id AS a_id

    ROW_NUMBER () OVER (PARTITION BY a1.id

    ORDER BY NULL

    ) AS r_num

    BY the a1

    )

    SELECT id

    element

    CASE

    WHEN a_id IS NOT NULL

    AND r_num = 1

    THEN part

    ELSE ' 0'

    END in the framework

    OF got_r_num

    ;

  • I used the trial before run, but I bought all the apps for 20.00 a month now. When I download it to my computer, it keeps telling me that my trial has expired. I uninstalled the program and reinstalled but it always says "expir├⌐ trial" any id

    I used the trial before run, but I bought all the apps for 20.00 a month now. When I download it to my computer, it keeps telling me that my trial has expired. I uninstalled the program and reinstalled but it always says "expiré trial" any ideas on what I can do? I paid already

    Log, activation, or connection errors. CS5.5 and later versions

    Mylenium

Maybe you are looking for