'Connect By' and 'Start With' in Discoverer

Hello,
I have a hierarchal query to show all child organizations under the parameter ':Parent_ID'
This is the query, I execute it in SQL Developer normally:
SELECT el.organization_id_child, ch.name,level*
FROM hr.hr_all_organization_units org,*
hr.PER_ORG_STRUCTURE_ELEMENTS el      ,*
hr.hr_all_organization_units ch*
WHERE el.org_structure_version_id         = 61*
AND org.organization_id                     = el.organization_id_parent*
AND ch.organization_id                      = el.organization_id_child*
START WITH el.organization_id_parent = :Parent_ID*
CONNECT BY el.organization_id_parent = PRIOR el.organization_id_child*
in the below line:
START WITH el.organization_id_parent = :Parent_ID*
The hierarchal query will start with parameter value to show all childes under that organization...
How can I use this simple query in Discoverer !! I am trying to find the START WITH in the discoverer also can not put this query in a new custom folder without removing the parameters.
Please Help...
Regards
Edited by: adelshehri on Oct 21, 2009 2:47 PM

Hi,
If you need to use the hierarchical query then you will not be able to pass a Discoverer parameter directly to the start with clause in the custom folder.
However, you can use a database context as a session parameter and use this parameter in the customer folder. More details on this can be found at LearnDiscoverer
Also you could put your hierarchical query into a table function passing the parent_id as a parameter to the table function. Then in your custom view you would join this to a table that returns the list of parent ids that you wish to use. e.g.
select f.organization_id_child, f.name,level
from hr.hr_all_organization_units par
, table (hierarchy_function(par.parent_id) f
where par.organization_id = :parent_id
Rod West

Similar Messages

  • Connect by and start with

    what do these comands do connect by and start with ? please answer thanks

    what do these comands do connect by and start with ? please answer thanks Here's an example that may help. In the EMP table you have all employees of a company; this includes
    all levels, President, managers, and (regular) employees.
    Let's say you want to know who works for who.
    First, just to see who is in the table
    select empno, ename, job from emp;
    EMPNO     ENAME     JOB           MGR
    7901     CLARK     MANAGER            7900
    7902     MILLER     CLERK          7901
    7903     SMITH     CLERK          7905
    7904     ADAMS     CLERK          7906
    7905     FORD     ANALYST          7907
    7906     SCOTT     ANALYST          7907
    7907     JONES     MANAGER     7900
    7908     ALLEN     SALESMAN     7909
    7909     BLAKE     MANAGER     7900
    7910     MARTIN     SALESMAN     7909
    7911     JAMES     CLERK          7912
    7912     TURNER     SALESMAN     7909
    7913     WARD     SALESMAN     7909
    7900     KING     PRESIDENT
    [\CODE]
    Now, using the START WITH and CONNECT BYSELECT LPAD(' ',2*(LEVEL-1)) || ename org_chart,
    empno, mgr, job
    FROM emp
    START WITH job = 'PRESIDENT'
    CONNECT BY PRIOR empno = mgr
    ORG_CHART     EMPNO     MGR     JOB
    KING          7900          PRESIDENT
    CLARK          7901     7900     MANAGER
    MILLER          7902     7901     CLERK
    JONES          7907     7900     MANAGER
    FORD          7905     7907     ANALYST
    SMITH          7903     7905     CLERK
    SCOTT          7906     7907     ANALYST
    ADAMS     7904     7906     CLERK
    BLAKE          7909     7900     MANAGER
    ALLEN          7908     7909     SALESMAN
    MARTIN          7910     7909     SALESMAN
    TURNER          7912     7909     SALESMAN
    JAMES          7911     7912     CLERK 30
    WARD          7913     7909     SALESMAN
    [\CODE]

  • Hierarchical connect by and start with and joins?

    I've got an employees table and an identifiers table. The identifiers table is hierarchical, with parents and children. Each employee has one or more identifiers, but only one identifier is considered the "primary" or root identifier for each employee. Unfortunately, the employee table might be pointing at one of the child identifier rows and not the root. I need a fast query to join the employees with their most current (root) identifier.
    Here's code to define the problem.
    create table employees (employeeid varchar2(8), fakeNationalID varchar2(9), empname varchar2(30));
    insert into employees (employeeid, fakeNationalID, empname) values (1,'001000001','John Smith');
    insert into employees (employeeid, fakeNationalID, empname) values (2,'002000002','James Jones');
    create table realids (realidkey NUMBER, fakeNationalID VARCHAR2(9) not null,
       realNationalID VARCHAR2(9) UNIQUE, parent_realidkey number);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (1,'001000001','111111111',3);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (2,'002000002','222222222',null);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (3,'003000003','333333333',null);
    commit;  
    create or replace function get_parentid (fakeID in VARCHAR2) return varchar2 is
       tempid VARCHAR2(9);
       begin
          select realNationalID into tempid
             from (
               select realNationalID, fakeNationalID
                  from realids
                  start with fakeNationalID = fakeID
                  connect by nocycle prior parent_realidkey = realidkey
                  order by level desc)
                  where rownum = 1;
          return tempid;
          exception
             when NO_DATA_FOUND then
                return NULL;
             when others then raise;
        end;
    select get_parentid('001000001') from dual; -- returns 333333333 because its linked to a parent
    select get_parentid('002000002') from dual; -- returns 222222222 because there is only one child
    select get_parentid('003000003') from dual; -- returns 333333333 because it is the parentWhat I want is to get the highest parent node in realids for each row in employees...
    This works, but is NOT very efficient:
    select employeeid, get_parentid(fakeNationalID) realid, empname from employees;
    employeeid   realid       empname
    1            333333333     John Smith
    2            222222222     James JonesYou can imagine what this would be like with 100K rows or greater. It takes about 3 minutes to run.
    This seemed like a good way to do this, but with a sub query.
    select e.employeeid, e.fakenationalid, e.empname, sub.realnationalid
       from employees,
          (select realidkey, fakenationalid, realnationalid, parent_realidkey
             from realids r
             start with r.fakenationalid = e.fakenationalid
             connect by prior r.parent_realidkey = r.realidkey) subUnfortunately, it produces an invalid identifier on e.fakenationalid (in the start with clause).
    Anyone have any ideas on how to get the top most parent node from the realids for each row in the employees table? In real life there are 6 or more employees tables spread across several remote instances some of which point at children in the realids table and some of which point at the parents. We always want the top most parent realid. Any help would be much appreciated.

    Hi,
    Thanks for posting the sample data in such a convenient form!
    It always helps to post your Oracle version, too, especially when dealing with CONNECT BY queries.
    The following does what you requested in Oracle 10:
    WITH     got_roots   AS
         SELECT     CONNECT_BY_ROOT     fakenationalid     AS leaf_id
         ,     realnationalid
         FROM     realids
         WHERE     CONNECT_BY_ISLEAF     = 1
         START WITH      fakenationalid IN ( SELECT  fakenationalid
                                              FROM    employees
         CONNECT BY     realidKEY     = PRIOR parent_realidkey
    SELECT     e.employeeid
    ,     r.realnationalid
    ,     e.empname
    FROM     employees     e
    JOIN     got_roots     r     ON     r.leaf_id     = e.fakenationalid
    ;In any query, calling a user-defined function for each row is going to be slow. Fortunately, Oracle now has built-in functions and operators that can take the place of get_parentid. The CONNECT_BY_ROOT operator, which was introduced in Oracle 10, is the key to this problem. In Oracle 9, you can get the same results using SYS_CONNECT_BY_PATH.
    It's usually faster to do the CONNECT BY query separately, and then join whatever other tables you need to the results.
    You had a good idea in your last query. The problem was that sub and employees were equal tables in the FROM clause, and you can't correlate equals. You can only correlate a sub-query to its super-query. You could make that general idea work by changing sub into a scalar sub-query,which could be correlated to employees, but I think it would be a lot less efficient than what I posted above.

  • Videos on Tenplay keep stopping and starting with wi-fi. Is there a fix??

    Videos/episodes on Tenplay keep stopping and starting with wi-fi. Is there a fix??

    Are you saying to use an ethernet cable and plug Apple TV into an ethernet port on the router??
    The router is in the study room and the Apple TV is in the lounge room, it is not far away but can't reach. How am I supposed to connect an ethernet cable it is too short and can not reach the router??

  • After Upgrading to 10.6.8 my aperture app starts but hangs trying to read the Lib. I removed the old lib and start with new. but still have the problem. 10.6.8 also made my Shark FX7 do the same thing. Any Ideas? Thanks

    After Upgrading to 10.6.8 my aperture app starts but hangs trying to read the Lib. I removed the old lib and start with new. but still have the problem. 10.6.8 also made my Shark FX7 do the same thing. Any Ideas? Thanks

    Verifying volume “Macintosh HD”
    Performing live verification.
    Checking Journaled HFS Plus volume.
    Checking extents overflow file.
    Checking catalog file.
    Checking multi-linked files.
    Checking catalog hierarchy.
    Checking extended attributes file.
    Checking volume bitmap.
    Checking volume information.
    The volume Macintosh HD appears to be OK.

  • Is it ok to leave my old photos in Aperature and start with new photos in Lightroom?  MacPro with 2 x 2.26 Ghz Quad-Core Intel Xeon processor, 6 GB memory, 1 TB harddrive.

    Is it ok to leave my old photos in Aperature and start with new photos in Lightroom?  MacPro with 2 x 2.26 Ghz Quad-Core Intel Xeon processor, 6 GB memory, 1 TB harddrive?
    Or should I transfer them to Lightroom?

    That's really a personal preference. Support for Aperture is coming to an
    end and you may find yourself unable to get to theses photos in the future
    in the case of a HDD crash if you can't get the software to reinstall.
    Faced with that prospect, I would probably put it on my list of things to
    do when I am feeling really bored and looking for something to amuse myself
    with. You can export your Aperture photos in their original format to a
    folder on your desktop and then import them into Lightroom. Use the copy
    option on the import to save the photos in a new folder within your
    Lightroom catalog.

  • HT2729 I bought a TV episode from iTunes (I have version 10 installed), but when I try to play it on my laptop, it keeps stopping and starting, with the voices out of sync with the action.  The action is stop/start as well.  What settings can I change to

    I bought a TV episode from iTunes (I have version 10 installed), but when I try to play it on my laptop, it keeps stopping and starting, with the voices out of sync with the action.  The action is stop/start as well., and occasionally it skips 5 or 10 seconds altogether, making it impossible to watch.  What settings can I change to fix the problem.

    Repair your QuickTime.
    Control Panel > Programs n Features > highlight QuickTime and click CHANGE then REPAIR.

  • I want to wipe my computer clean and start with a new installation of Lion

    My MBP has been acting strange.  I want to wipe it completely clean and start with a brand new installation of Lion.  How do I do that?  I know I can access the recovery partition by pressing 'Command+r' during the boot process.  However, do I need to use the disk utility option first and erase my internal hard drive?  Then do I use the new lion instal option?
    Or if I choose the new lion isntallation from the recovery partition, does it erase my drive first?
    -jon

    What error?
    The sync is one way - computer to iphone.  The only exception is itunes purchases.  File>Transfer Purchases
    It has always been very basic to always maintain a backup copy of your computer.  Have you failed to do this?

  • Connecting MBA and iphone with bluetooth?

    connecting MBA and iphone with bluetooth?

    Do you have a question specifically?
    How does it work?
    Why isn't my configuration working?
    I'm getting an error message?
    What do I need to do to make it work?
    Otherwise, Yes.

  • Join two Connect By Prior Start With trees and return only common records?

    Oracle 10g Release 2 (10.2)
    I have two tables that have tree structured data. The results, when running the queries individually are correct, however I need to join tree one to tree two in order to obtain only the common records between them.
    -- Tree one
    SELECT ip_entity_name, entity_code, hier_level, entity_parent
    FROM ip_hierarchy
    WHERE hier_level >= 3
    CONNECT BY PRIOR entity_code = entity_parent
    START WITH entity_code = 'MEWWD';
    -- Tree two
    SELECT ip_entity_name, entity_code, hier_level, entity_parent
    FROM ipt_hierarchy
    WHERE hier_level >= 3
    CONNECT BY PRIOR entity_code = entity_parent
    START WITH entity_code = 'IPNAM';
    As I understand, joins may not work with CONNECT BY/START WITH queries?
    Is a WITH clause an option?
    If at all possible, I don't want to put one select in a View database object and join against the other query.
    Thanks.

    Hi JTP51,
    You can use WITH clause or sub-query by using in-line view, without creating any view object in database.
    for example
    SELECT A.IP_ENTITY_NAME, A.ENTITY_CODE, ....
      FROM (SELECT IP_ENTITY_NAME, ENTITY_CODE, HIER_LEVEL, ENTITY_PARENT
              FROM IP_HIERARCHY
             WHERE HIER_LEVEL >= 3
            CONNECT BY PRIOR ENTITY_CODE = ENTITY_PARENT
             START WITH ENTITY_CODE = 'MEWWD') A,
           (SELECT IP_ENTITY_NAME, ENTITY_CODE, HIER_LEVEL, ENTITY_PARENT
              FROM IPT_HIERARCHY
             WHERE HIER_LEVEL >= 3
            CONNECT BY PRIOR ENTITY_CODE = ENTITY_PARENT
             START WITH ENTITY_CODE = 'IPNAM') B
    WHERE A. ENTITY_CODE = B. ENTITY_CODE
    AND ....Best regards,
    Zhxiang
    Edited by: zhxiangxie on Feb 2, 2010 5:35 PM

  • Creating a report transaction(SE93) and Start with variant

    I have a report that I am creating a transaction using SE93 with in our development client.  I also have a variant associated with this report.
    When I am on SE93, I entered the program name, selection screen = 1000, and choose the dropdown list for "Start with variant", nothng appears.  My variant does not appear in the dropdown.  Why is that? 
    I also tried creating a transport for the variant, thinking that this was the problem, but that didn't help either.
    What am I missing here?
    Thanks for your help.

    Just type the variant name instead of F4. You may see some inconsistencies because the variant is created under local object.
    Edited:
    Right answer would be
    Go to se38 - Enter the program name - choose variants - Change - Enter variant name (choose attributes but not values) - go to UTILITIES (on application menu) - Transport request - Create a transport before you create a transaction.
    The reason: You cannot use local variant in transactions and the variants you have created in the program are local.
    Good luck
    Edited by: Sampath Kumar on Nov 16, 2009 11:04 AM
    Edited by: Sampath Kumar on Nov 16, 2009 11:07 AM

  • Brand New 80GB Ipod connects on and off with my usb cable

    hi, i just got a new 80gb ipod for xmas, and when i plug the usb cable to my ipod, it connects sometimes, and sometimes doesnt, and when it does, it disconnects sometimes too, i usually have to keep moving into different usb ports and one will work, then not work again, then work again later. i even tried my friends cable and its the same thing, i think somethings wrong with the port in the ipod, can anyone help ?

    Turn it off.  If it got wet somehow, you may try drying your ipod off.  The slow method would be a sunny window sill.  You could use a hair dryer on LOW, pointing it at the contacts.  When it drys out, charge itand try a hard-reset. If it still doesn't function properly....  ?

  • Sound stops and starts with x-fi titanium pci e

    I am going nuts with this problem and creative support is not much help atm, so I have been troubleshooting myself. Whats going on is my sound stops, starts, and stutters a lot. It is pretty bad when I play music files but it is absolutely horrible when I watch videos like on CNN or YOU TUBE. It is like a old vinyl record skipping, except when this gets off a stutter, it races to where it should be on the time line. Also my creative console does not work right. I cannot use the equalizer, as the custom, rock, pop music select is greyed out and the box is checked to use the equlaizer. It also disappears when I click on a few tabs, like between speakers, bass, equalizer..then its just gone and I have to click the shortcut again to get it back.
    What I have done so far is un-install everything, and do a clean boot, then re-install and I have the same problems. Though I downloaded the creative console beta(2.6.49) and it seemed to have fixed my issues with that. But downloading the new drivers (2.7.8) does not fix the stopping and starting.
    Any suggestions?
    I should mention I use klipsitch speakers..2.1, I don't have surround sound anymore.
    Customer service had me run a registry cleaner and use it to uninstall everything creative. I used CCleaner, then used direct links to download drivers...again...(2.7.8) and a creative console(2.6.35)..guess what? It didn't work, same problems, though I downloaded and re-installed the beta for the creative console(2.6.49) and now it works fine. I also did all this under a clean boot..again.

    Check if "Play Stereo Mix using Digital Output" is checked in the Console launcher in Settings/Digital IO.

  • HT1751 now that I have Organized my itunes library .How can I now clean out my old cloud and start with a nice clean labeled list of music

    I need to know how to clean out my old cloud and start fresh one?

    Restore the iPod (thus erasing it), resync all the music to it from the PC.

  • Connection MESG and INOB with additional field

    Hi friends,
    i'm beginner in ABAP and for this reason i create reports in ABAP query.
    So i create query between tables MSEG and INOB (then INOB with AUSP).
    In INOB-OBJEK - value is matnr and charg,
    but value in this field is: for example 
    matnr                    charg
    EK759064BK (8 free spaces) 0000000066
    EK759064BK (8 free spaces) 0000000067
    EK759064BK (8 free spaces)  0000000068
    EK759064BK (8 free spaces)  0000000069
    EK759064BK (8 free spaces) 0000000070
    My idea is to create additional field with MSEG-MATNR and MSEG-CHARG and relate with INOB-OBJEK
    (concatenate mseg-matnr mseg-charg into refkey.) 
    result is:
    EK759064BK0000000066
    EK759064BK0000000067
    EK759064BK0000000068
    EK759064BK0000000069
    EK759064BK0000000070
    Now my question is how to change code and create additional field like INOB-OBJEK, how to change my code so i have 8 free spaces between MATNR and CHARG?
    Edited by: Marin Lyubomirov on Dec 13, 2009 9:39 AM

    the ABAP keyword CONCATENATE has a parameter RESPECTING BLANKS
    So if you use this this parameter, then you would get the missing 8 spaces, because the material number field is 18 long and your material only 10 long.
    Alternative, just use an own field that is 8 long and do the concatenation like this :
    concatenate mseg-matnr myfield mseg-charg into refkey

Maybe you are looking for

  • SSO to BSP

    Hi everybody, I've tried to perform SSO to an BSP from Portal through the AppIntegrator Generic iView Template. So I didn't used the BSP Template. First I created a system from par file sap.com.portal.howtos.webapp and made all the settings. After th

  • Backorder open purchase order report

    Hi All, Any item that have an open PO in the system for xx, yy & zz are coming up as backorder on the reports. Not all on order items are actually on backorder. Could you please advice what steps we need to do. Instance details: 11.5.10, Linux

  • [Request] Move Windows Control Panel applet from "System and Security" to "Programs"

    The "Flash Player (32-bit)" Windows Control Panel applet should be  moved from "System and Security" to "Programs" where the Java applet is. Vote: https://bugbase.adobe.com/index.cfm?event=bug&id=2953107 Thanks

  • Calendar Picture Quality Warning

    I am converting some old 35mm slides my father has and creating a calendar for him for Christmas. The pictures look good in iphoto. I add them to the calendar and in the upper right corner of the picture there is a yellow warning triangle. When I com

  • Understanding Specs: Mac Mini

    First, let me apologize if this is the wrong thread; I am new to these forums. I am currently using a MacBook as my primary computer (2.4 GHz / 2GB DDR2), and I am looking to purchase a new (or new to me) Mac Mini to use instead. Don't get me wrong -