Need query or Tree

Hi,
I have employee table, i need to show the details of employees who are working under a manager till this it ok,but i have one more conditon is that, if the manager has any sub mangers, i need to show the employees who are working under sub mangare.
empno ename mgrid are the main fileds in my table
Please help me in this by providing a query or creating a tree
thanks
Regards,
Rajesh

Hi,
Do you mean something like this -
SQL> select * from emp;
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      7839 KING       PRESIDENT            17-NOV-81                               10
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
SQL> select
  2    lpad('*', level * 2) || ename as ename
  3  from
  4    emp
  5  start with mgr is null
  6  connect by prior empno = mgr;
      ENAME
       *KING
         *BLAKE
           *ALLEN
           *WARD
           *MARTIN
           *TURNER
           *JAMES
         *CLARK
           *MILLER
         *JONES
           *SCOTT
             *ADAMS
           *FORD
             *SMITH
14 rows selected.

Similar Messages

  • Need to expand tree by passing treeId thr URL not by clicking manually.

    Sub: Need to expand tree by passing Id thr URL.
    Hi,
    Here i have Library.java and ajaxTree.jsf files (collected from Jboss richfaces)
    There is having a list of artist .
    If u click on a particular artistname then the respective albums(with their checkboxes) will expand and show like a treenode.
    just look at d url : "http://localhost:8080/richfaces-demo-3.2.1.GA/richfaces/tree.jsf?c=tree&albumIds=1001,1002,1005,1008,1009,1010&client=0"
    I m passing album Ids and clientId in url browser and receiving in d Library.java.
    I need to expand the required client tree to show albums without clicking on artistname rather by passing the clientId from Url.
    I thnk one EventHandling class( PostbackPhaseListener.java ) is responsible for expanding but I m unable to understand.
    How can I do it.
    Plz help asap.
    /###############ajaxTree.jsf##########Start##############/
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:c="http://java.sun.com/jstl/core">
         <p>This tree uses "ajax" switch type, note that for collapse/expand operations it will be Ajax request to the server. You may see short delay in this case.</p>
         <h:form>     
              <rich:tree style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}">
                   <rich:treeNode type="artist" >
                        <h:outputText value="#{item.name}" />
                        </rich:treeNode>
                   <rich:treeNode type="album" >
                        <h:selectBooleanCheckbox value="#{item.selected}"/>
                        <h:outputText value="#{item.title}" />
                   </rich:treeNode>
              </rich:tree>
              <h:commandButton value="Update" />
         </h:form>
    </ui:composition>
    /###############ajaxTree.jsf##########End##############/
    /************************Library.java*********Start****************/
    package org.richfaces.demo.tree;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    import java.util.StringTokenizer;
    import javax.servlet.http.HttpServletRequest;
    import javax.faces.context.FacesContext;
    import org.richfaces.model.TreeNode;
    public class Library implements TreeNode {
         private static final long serialVersionUID = -3530085227471752526L;
         private Map artists = null;
         private Object state1;
         private Object state2;
         private Map getArtists() {
              if (this.artists==null) {
                   initData();
              return this.artists;
         public void addArtist(Artist artist) {
              addChild(Long.toString(artist.getId()), artist);
         public void addChild(Object identifier, TreeNode child) {
              getArtists().put(identifier, child);
              child.setParent(this);
         public TreeNode getChild(Object id) {
              return (TreeNode) getArtists().get(id);
         public Iterator getChildren() {
              return getArtists().entrySet().iterator();
         public Object getData() {
              return this;
         public TreeNode getParent() {
              return null;
         public boolean isLeaf() {
              return getArtists().isEmpty();
         public void removeChild(Object id) {
              getArtists().remove(id);
         public void setData(Object data) {
         public void setParent(TreeNode parent) {
         public String getType() {
              return "library";
         private long nextId = 0;
         private long getNextId() {
              return nextId++;
         private Map albumCache = new HashMap();
         private Map artistCache = new HashMap();
         private Artist getArtistByName(String name, Library library) {
              Artist artist = (Artist)artistCache.get(name);
              if (artist==null) {
                   artist = new Artist(getNextId());
                   artist.setName(name);
                   artistCache.put(name, artist);
                   library.addArtist(artist);
              return artist;
         private Album getAlbumByTitle(String title, Artist artist) {
              Album album = (Album)albumCache.get(title);
              if (album==null) {
                   album = new Album(getNextId());
                   album.setTitle(title);
                   albumCache.put(title, album);
                   artist.addAlbum(album);
              return album;
         private void initData() {
              artists = new HashMap();
              InputStream is = this.getClass().getClassLoader().getResourceAsStream("org/richfaces/demo/tree/data.txt");
              ByteArrayOutputStream os = new ByteArrayOutputStream();
              byte[] rb = new byte[1024];
              int read;
              HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
         //     System.out.println("request.getParameter(param) "+request.getParameter("param"));
              //System.out.println("request.getParameter(client) "+request.getParameter("client"));
              //System.out.println("request.getParameter() "+request.getParameter("c"));
              try {
                   do {
                        read = is.read(rb);
                        if (read>0) {
                             os.write(rb, 0, read);
                   } while (read>0);
                   String buf = os.toString();
                   StringTokenizer toc1 = new StringTokenizer(buf,"\n");
                        String str1 = request.getParameter("albumIds");
                        int clientId1 =Integer.parseInt( request.getParameter("client"));
                   while (toc1.hasMoreTokens()) {
                        String str = toc1.nextToken();
                        StringTokenizer toc2 = new StringTokenizer(str, "\t");
                        String artistName = toc2.nextToken();
                        String albumTitle = toc2.nextToken();
                        String songTitle = toc2.nextToken();
                        toc2.nextToken();
                        toc2.nextToken();
                        String albumYear = toc2.nextToken();
                        Artist artist = getArtistByName(artistName,this);
                        Album album = getAlbumByTitle(albumTitle, artist);
                        String portfolios[] = new String[100];
                        Integer portfoliosId[] = new Integer[100];
                        int i = 0;
                        StringTokenizer st = new StringTokenizer(str1, ",");
                        while (st.hasMoreTokens()) {
                        portfolios[i] = st.nextToken();
                        if((songTitle.equals(portfolios))&&(!(songTitle == ""))){
                                  //System.out.println("ifff");
                                  album.setSelected(true);
                        i++;
                        album.setYear(new Integer(albumYear));
              } catch (IOException e) {
                   throw new RuntimeException(e);
         public Object getState1() {
              return state1;
         public void setState1(Object state1) {
              this.state1 = state1;
         public Object getState2() {
              return state2;
         public void setState2(Object state2) {
              this.state2 = state2;
         public void walk(TreeNode node, List<TreeNode> appendTo, Class<? extends TreeNode> type) {
              if (type.isInstance(node)){
                   appendTo.add(node);
              Iterator<Map.Entry<Object, TreeNode>> iterator = node.getChildren();
              System.out.println("walk node.getChildren() "+node.getChildren());
              while(iterator.hasNext()) {
                   walk(iterator.next().getValue(), appendTo, type);
         public ArrayList getLibraryAsList(){
              ArrayList appendTo = new ArrayList();
              System.out.println("getLibraryAsList appendTo "+appendTo);
              walk(this, appendTo, Song.class);
              return appendTo;
    /************************Library.java*********End****************/
    /************************PostbackPhaseListener.java*********Start****************/
    package org.richfaces.treemodeladaptor;
    import java.util.Map;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    import javax.faces.event.PhaseEvent;
    import javax.faces.event.PhaseId;
    import javax.faces.event.PhaseListener;
    public class PostbackPhaseListener implements PhaseListener {
         public static final String POSTBACK_ATTRIBUTE_NAME = PostbackPhaseListener.class.getName();
         public void afterPhase(PhaseEvent event) {
         public void beforePhase(PhaseEvent event) {
              FacesContext facesContext = event.getFacesContext();
              Map requestMap = facesContext.getExternalContext().getRequestMap();
              requestMap.put(POSTBACK_ATTRIBUTE_NAME, Boolean.TRUE);
         public PhaseId getPhaseId() {
              return PhaseId.APPLY_REQUEST_VALUES;
         public static boolean isPostback() {
              FacesContext facesContext = FacesContext.getCurrentInstance();
              if (facesContext != null) {
                   ExternalContext externalContext = facesContext.getExternalContext();
                   if (externalContext != null) {
                        return Boolean.TRUE.equals(
                                  externalContext.getRequestMap().get(POSTBACK_ATTRIBUTE_NAME));
              return false;
    /************************PostbackPhaseListener.java*********End****************/
    Edited by: rajesh_forum on Sep 17, 2008 6:13 AM
    Edited by: rajesh_forum on Sep 17, 2008 6:18 AM

    Hi
    Can somebody please look into this?
    Thanks
    Raj
    Edited by: RajICWeb on Aug 9, 2009 4:38 AM

  • Need query to find out whether exactly 2 columns are used in any index ?

    Suppose i have two columns ID and Status (or any number of columns ) belongs to table customer...
    Now I want to create below index
    Ex. create index test1 on customer (ID , Status )
    But before creating this index i want to check that whether there is already index on these 2 columns ? May be by other name ?
    Need query for this.
    Plz help.

    Hi Shubhangi,
    Your requirement is very difficult to fulfill , i have made an attempt to replicate your reqrmnt & write a query wherein you need to compromise on few things , let us see if it works for you
    Supply table_name/owner & Number of column on which you want to find indexes
    e.g.
    select distinct INDEX_NAME,column_name
    from dba_ind_columns
    where index_name in (select distinct index_name
    from dba_ind_columns
    where table_name='&table_name'
    and table_owner='&owner'
    having count(column_name)=&column_count group by index_name);
    Enter value for table_name: ADDRESS
    Enter value for owner: ASAP
    Enter value for column_count: 2
    INDEX_NAME COLUMN_NAME
    FKIDX_AD__SF_ST_FO SF_STRUC_FORMAT_NM
    FKIDX_AD__SF_ST_FO SF_TYPE_NM
    SQL> /
    Enter value for table_name: ADDRESS
    Enter value for owner: ASAP
    Enter value for column_count: 3
    INDEX_NAME COLUMN_NAME
    FKIDX_AD__SF_ST_FO_1 POSTAL_CD
    FKIDX_AD__SF_ST_FO_1 SF_STRUC_FORMAT_NM
    FKIDX_AD__SF_ST_FO_1 SF_TYPE_NM
    Thanks,
    Ajay More
    http://moreajays.blogspot.com

  • Need query to find rows

    hi
    i need query to find out for one perticular row from parent table ,,which references how many rows in how many child tables , and child to child tables. in herirachy fashion.
    if anybody know please help me

    I guess it would be difficult to come up with a generic script to get answer that can help in all situations...you have to see the table definitions in your schema and try...like in case of emp and dept table,
    select * from dept where deptno in
    (select deptno,count(*) from emp group by deptno having count(*)>1)
    (this gives rows from dept table where , for corresponding deptno there are more than one rows in emp table).
    Thanks
    Nirav

  • Need Query - join in same table

    I need query for following criteria,
    Table : test
    No     Order
    1     a
    1     b
    1     c
    2     a
    2     b
    2     d
    3     e
    3     f
    3     g
    3     h
    1     f
    2     f
    Consider the above table,
    1)     I will give input order as a,b: It should return No 1,2
    No     Order
    1     a
    1     b
    1     c
    2     a
    2     b
    2     d
    3     e
    3     f
    3     g
    3     h
    1     f
    2     f
    2)     I will give input order as f,g,h: It should return No 3
    No     Order
    1     a
    1     b
    1     c
    2     a
    2     b
    2     d
    3     e
    3     f
    3     g
    3     h
    1     f
    2     f
    Please give me the query which will give above result.
    Thanks

    I am not sure I understand you, but it may be this
    with test as (
    select 1 N, 'a' Ord from dual union all
    select 1,'b' from dual union all
    select 1,'c' from dual union all
    select 2,'a' from dual union all
    select 2,'b' from dual union all
    select 2,'d' from dual union all
    select 3,'e' from dual union all
    select 3,'f' from dual union all
    select 3,'g' from dual union all
    select 3,'h' from dual union all
    select 1,'f' from dual union all
    select 2,'f' from dual )
    select N from test tp where Ord = 'a'
    intersect
    select N from test tp where Ord = 'b';
    with test as (
    select 1 N, 'a' Ord from dual union all
    select 1,'b' from dual union all
    select 1,'c' from dual union all
    select 2,'a' from dual union all
    select 2,'b' from dual union all
    select 2,'d' from dual union all
    select 3,'e' from dual union all
    select 3,'f' from dual union all
    select 3,'g' from dual union all
    select 3,'h' from dual union all
    select 1,'f' from dual union all
    select 2,'f' from dual )
    select N from test tp where Ord = 'f'
    intersect
    select N from test tp where Ord = 'g'
    intersect
    select N from test tp where Ord = 'h';

  • Need Query to display

    Hi Folks,
    I need query for displaying following:
    Adjusted A/R Balance:-
    Sum of all open Receivables transactions for the Bill To address for a :Particular_Customer. Total of all open items (Invoice, Credit Memos, CLAIMS, ON ACCTS, UNAPPLIED, DEBIT MEMOS) PLUS any orders that have been approved but not yet invoiced.
    ================================================================================
    Credit Tolerance:-
    Percentage of Credit Limit that is the allowed tolerance for exceeding the credit limit. Determined by the following calculation: (Exposure Credit Limit ((Credit Tolerance + 100)* Credit Limit / 100) – Credit Limit)/Credit Limit.
    would be very greatful if someone can help on same.
    Thanks in advance.
    Regards,
    gvk.

    another example would be:
    SQL> with emp1 as
      2  (select 10 emp_id, 'AAAA' emp_name from dual
      3   union all
      4   select 22 emp_id, 'BBBB' emp_name from dual
      5   union all
      6   select 15 emp_id, 'BBBB' emp_name from dual
      7   union all
      8   select 17 emp_id, 'cccc' emp_name from dual
      9   union all
    10   select  4 emp_id, 'DDDD' emp_name from dual
    11   union all
    12   select  5 emp_id, 'EEEE' emp_name from dual
    13   union all
    14   select 53 emp_id, 'EEEE' emp_name from dual)
    15  select emp_id id, emp_name name from emp1;
            ID NAME
            10 AAAA
            22 BBBB
            15 BBBB
            17 cccc
             4 DDDD
             5 EEEE
            53 EEEE
    7 rows selected.
    SQL> with emp1 as
      2  (select 10 emp_id, 'AAAA' emp_name from dual
      3   union all
      4   select 22 emp_id, 'BBBB' emp_name from dual
      5   union all
      6   select 15 emp_id, 'BBBB' emp_name from dual
      7   union all
      8   select 17 emp_id, 'cccc' emp_name from dual
      9   union all
    10   select  4 emp_id, 'DDDD' emp_name from dual
    11   union all
    12   select  5 emp_id, 'EEEE' emp_name from dual
    13   union all
    14   select 53 emp_id, 'EEEE' emp_name from dual)
    15  select row_number() over (order by emp_name, emp_id) rn,
    16         emp_id   id,
    17         emp_name name
    18    from emp1;
            RN         ID NAME
             1         10 AAAA
             2         15 BBBB
             3         22 BBBB
             4          4 DDDD
             5          5 EEEE
             6         53 EEEE
             7         17 cccc
    7 rows selected.
    SQL>

  • Need Query for empty partitions

    I am having nearly 700 partitions for a table.Now i want to find out only the empty partitions.I need query for that.
    Thankx..

    Not the most elegant solution, but it works:
    declare
    rc number;
    str varchar2(200);
    begin
    for i in (select table_owner, table_name, partition_name from dba_tab_partitions) loop
    str := 'select count(*) from ' || i.table_owner || '.' || i.table_name || ' partition (' || i.partition_name || ')';
    execute immediate str into rc;
    if rc = 0 then
    dbms_output.put_line(i.table_owner || '.' || i.table_name);
    end if;
    end loop;
    end;

  • Need query help regarding employee retirement age.

    Need query to find employee retirement age 2years in advance.

    You can use per_all_people_f table.
    something like this :-
    SELECT PAPF.employee_number,
    PAPF.date_of_birth,
    (MONTHS_BETWEEN(SYSDATE,PAPF.date_of_birth) / 12)+2 RETIREMENT_AGE_FIGURE
    FROM per_all_people_f PAPF
    WHERE TRUNC (SYSDATE) BETWEEN PAPF.effective_Start_date AND PAPF.effective_end_date
    AND (MONTHS_BETWEEN(SYSDATE,date_of_birth) / 12)+2 >=65 /* ASSUMING 65 IS RETIREMENT AGE HERE*/
    In case if you only want to pick Employee data then use below sample query and modify according to your requirement :-
    SELECT PAPF.employee_number,
    PAPF.date_of_birth,
    ((MONTHS_BETWEEN(SYSDATE,PAPF.date_of_birth) / 12)+2) RETIREMENT_AGE_FIGURE,
    PPT.system_person_type,
    PPT.user_person_type
    FROM per_all_people_f PAPF,
    per_person_types PPT,
    per_person_type_usages_f PPTUF
    WHERE TRUNC (SYSDATE) BETWEEN PAPF.effective_Start_date AND PAPF.effective_end_date
    AND ((MONTHS_BETWEEN(SYSDATE,date_of_birth) / 12)+2) >=65
    AND PPTUF.person_id = PAPF.person_id
    AND PPT.person_type_id = PPTUF.person_type_id
    AND PPT.system_person_type = 'EMP'
    AND TRUNC (SYSDATE) BETWEEN PPTUF.effective_Start_date AND PPTUF.effective_end_date
    Edited by: VISHAL DANGI on Jul 8, 2012 10:30 PM

  • I need query to split the string

    I need query to split the input string into comma seperated triplets values.
    Input String: Database
    Output : Dat, ata,tab,aba,bas,ase

    SQL> with t
      2  as
      3  (
      4  select 'Database' str
      5    from dual
      6  )
      7  select substr(str, level, 3) str
      8    from t
      9   where length(substr(str, level, 3)) = 3
    10  connect by level <= length(str);
    STR
    Dat
    ata
    tab
    aba
    bas
    ase
    6 rows selected.
    And if you want it as a single string then..
    SQL> with t
      2  as
      3  (
      4  select 'Database' str
      5    from dual
      6  )
      7  select ltrim(sys_connect_by_path(str, ','), ',') str
      8    from (
      9            select row_number() over(order by level) rno
    10                 , substr(str, level, 3) str
    11              from t
    12             where length(substr(str, level, 3)) = 3
    13            connect by level <= length(str)
    14         )
    15   where connect_by_isleaf = 1
    16   start with rno = 1
    17  connect by rno = prior rno + 1;
    STR
    Dat,ata,tab,aba,bas,ase

  • Need to create tree-view page.

    I'm trying to create a tree-view display using Oracle JDeveloper 10g Release 3, ADF and JSF.
    I need to show a tree (folder names) and on a click of the last level folder to show table with File names that are related to the selected folder.
    Data is stored in two tables:
    1. contains Folder names and hierarchy relations;
    2. contains File names.
    These tables related by folder ID.
    Using ADF Faces Component, I created a 3 level Tree that expends and collapses each level of Folder names but I don't know how to populate the View part (table with File names). Basically, I need to take an ID of the selected row in the Tree and pass it as a parameter to the View table query where clause.

    Since this is not a hibernate forum i suggest you ask your question about hibernate somewhere else.

  • Need Simple Hierarchical Tree Example

    Can someone e-mail me a simple, working hierarchical tree example, along with what tables i need to insert into the database? Like the car/airplane example, or employee/department example.
    I tried following the instructions in the Introduction to Hierarchical Tree example from metalink, but the tree still does not display on my form, even though the data query is valid. Nothing happens when i click the button.
    I need this pretty urgently, so any help will be appreciated! Thanks! My e-mail is [email protected]

    Thats what i don't understand, you see. There is no query error. I know when there is, because when i type the query wrongly, the error prompts. However, when the query is correct, nothing happens. When i go through in debug mode, it does enter the statement to populate the tree. This is my record group/data query(i tried putting it in both) :
    SELECT initial_level
    ,node_depth
    ,node_label
    ,node_icon
    ,node_data
    FROM MyTreeData
    START WITH node_parent IS NULL
    CONNECT BY node_parent = prior node_data
    This is my populate tree code :
    DECLARE
         htree ITEM;
         top_node FTREE.NODE;
         find_node FTREE.NODE;
    BEGIN
         -- Find the tree itself.
         htree := FIND_ITEM('mytreeblock.mytree');
         -- Populate the tree with data.
         ftree.Populate_Tree(htree);
    END;
    This is the format of data in the database :
    initial_level node_depth node_label node_icon node_data node_parent
    -1 2 Car Null CAR TRANSPORT
    -1 2 Plane Null PLANE TRANSPORT
    0 2 Bike NULL BIKE TRANSPORT
    1 1 Transport NULL TRANSPORT
    0 3 Honda NULL HONDA CAR
    0 3 Boeing 747 NULL 747-400 PLANE
    0 3 Mazda NULL MAZDA CAR
    I hope its not a problem with my Forms program, so i'm hoping that someone can e-mail me a working one to see. I've been reading up on this for a few days already, but i do not know why its not working.
    Thanks for your help again, Kevin! I really appreciate it.

  • Need help, MMC tree got deleted, very urgent.

    Hi,
    My sap MMC tree, got deleted in the server. I have been trying to restore since 2 days and couldnt succeed, please help me.
    1) i have uncared the sapmmc.sar from   Kernal\NT\I386\MMC\sapmmc.sar file
    2) i got about 7 files, in which there is one sapmmc file i have tried to double click it, n check but no go.
    3) i also tried to run the Sapstartsrv.exe file and fill in up the values in pop up window. & filled up the following values :-
                        SID: DEV
                        NR: 00
                        StartProfile:  (entire start profile path given)
                        user: devadm
                        passwd; (given)
    - but it says "the account name is invalid or does not exist or the password is invalid for account name specified"/
    - no go in both the cases.
    Please need help very urgent.
    Regards,
    Satish.

    siva,
    I am getting same error since 2 days
    SID: DEV
    NR: 00
    Start Profile: (entire start profile path)
    User: <hostname>/devadm
    passwd: ****
    Error:
    cannot install service
    create service failed:421
    The account name is invalid or doesnot exist, or the passwd is invalid for the account name specified.
    Edited by: satish c on Jun 4, 2008 11:12 AM

  • Need help with tree edit distance and restricted top-down mapping algorithm

    *This topic was posted a while ago in "java programming" section but was suggested to try here
    Hi everyone,
    A couple of days ago I posted a topic on analyzing structure similarity between two web pages. After some researching, I know I need to work out some tree matching algorithms: tree edit distance algorithm(TED) and a improved version: restricted top-down mapping algorithm(RTDM). TED is about calculating the minimum operation cost(insert, delete, replace) to map one tree into another. RTDM further restricts the 3 operations to only the leaf nodes so as to improve time complexity.
    This is the general idea but I'm having difficulties to find resources to let me understand and implement the algorithms. I'm using ACM portal (Association for Computing Machinery) to access the technical papers but I find that they do not provide enough info, google gives mostly the same technical papers and some websites which illustrate the general idea of these algorithms.
    Hoping that you can give me some guidance on these 2 algorithms. Not looking for codes but I need more details on them. Thanks in advance.

    For scientific research I prefer Scirus: http://www.scirus.com/
    Just two pages I found on a quick search:
    http://arxiv.org/abs/cs/0604037
    http://www.cs.uic.edu/~yzhai/
    The latter might not be exactly what you asked for, but you might be interested in the listed publications. I have not taken a closer look.

  • Perform a query on tree node click

    This is probably very easy and I'm just having brain freeze..
    I have an application that is using ColdFusion to provide
    data for various controls. One control is a tree showing two levels
    of data (main level shows the process/job number, then you open
    that to see all the event numbers for that job). This all works
    fine.
    Now what I want to do is when you select an even number, flex
    will use a coldfusion page I set up to perform a query on the
    database using the event number and job number to get all the rest
    of the data about htat particular job (description, run times, etc)
    I have the click event from the tree control working fine, I
    have the page in coldfusion working fine, it outputs an XML format
    file with all the relevant details based on the parameters you send
    it. Now the question is, how do I populate the fields on the form
    with the data returned from the query?
    I am using a HTTPService call to get the data to/from
    ColdFusion (I have version 6.1 of Coldfusion).
    Thanks for any help.

    Well, I answered my own question... Here is what I did in
    case anyone else wants to know. If there is a better way, please
    advise.
    I have a click event on the tree control. Since the tree will
    only be two levels deep (parent and child) I test for whether the
    item clicked has a parent. If it does, I know they clicked on a
    child node. I then fire off the HTTPService with the parameters
    from the child and parent nodes of the tree item that was clicked.
    In the result parameter of the HTTPService, I populate the
    various fields using the lastresult.root.fieldname syntax of the
    HTTPService.
    It works as expected, but perhaps there is a better
    way?

  • Urgent Need: Query is taking time

    Hi,
    I have a query which is taking lots of time.Please help me in this regard...
    select subscripti0_.RENTAL_ID as RENTAL1_101_0_, movieprodu1_.product_id as product1_45_1_, moviepacka2_.PACKAGE_ID as PACKAGE1_47_2_, movietitle3_.TITLE_ID as TITLE1_48_3_, subscripti0_.LOGICAL_QUEUE_POSITION as LOGICAL2_101_0_, subscripti0_.STATUS as STATUS101_0_, subscripti0_.RENT_CODE as RENT4_101_0_, subscripti0_.IS_VISIBLE_FLAG as IS5_101_0_, subscripti0_.SHIP_DATE as SHIP6_101_0_, subscripti0_.DATE_CHECK_IN as DATE7_101_0_, subscripti0_.SET_NBR as SET8_101_0_, subscripti0_.ALLOCATION_DATE as ALLOCATION9_101_0_, subscripti0_.USPS_SHIP_DATE as USPS10_101_0_, subscripti0_.CENTRAL_CHECKIN_DATE as CENTRAL11_101_0_, subscripti0_.ESTIMATED_ARRIVAL_DATE as ESTIMATED12_101_0_, subscripti0_.CREATED_BY as CREATED13_101_0_, subscripti0_.CREATED_DATE as CREATED14_101_0_, subscripti0_.UPDATED_BY as UPDATED15_101_0_, subscripti0_.UPDATED_DATE as UPDATED16_101_0_, subscripti0_.SUBSCRIPTION_ID as SUBSCRI17_101_0_, subscripti0_.MOVIE_ID as MOVIE18_101_0_, movieprodu1_.ONLINE_RELEASE_DATE as ONLINE2_45_1_, movieprodu1_.PRODUCT_TITLE as PRODUCT3_45_1_, movieprodu1_.PACKAGE_ID as PACKAGE4_45_1_, movieprodu1_1_.AVAILABILITY_BAND as AVAILABI2_46_1_, movieprodu1_1_.TOTAL_RENTABLE_INVENTORY as TOTAL3_46_1_, NVL(movieprodu1_.ONLINE_FLAG, 0) as formula0_1_, NVL(movieprodu1_.PRIMARY_PRODUCT, 0) as formula1_1_, moviepacka2_.TITLE as TITLE47_2_, moviepacka2_.dvd_release_date as dvd3_47_2_, moviepacka2_.FORMAT as FORMAT47_2_, moviepacka2_.PACKAGE_MPAA as PACKAGE5_47_ 2_, moviepacka2_.T_ARTICLE as T6_47_2_, moviepacka2_.TITLE_ID as TITLE7_47_2_, movietitle3_.TITLE as TITLE48_3_, movietitle3_.THEATRICAL_RELEASE as THEATRICAL3_48_3_, movietitle3_.TITLE_MPAA as TITLE4_48_3_, movietitle3_.LEGACY_ID as LEGACY5_48_3_, movietitle3_.AVERAGE_USER_RATING as AVERAGE6_48_3_, movietitle3_.RUNNING_TIME as RUNNING7_48_3_, movietitle3_.PRIMARY_PACKAGE_ID as PRIMARY8_48_3_, movietitle3_1_.BUY_NEW as BUY2_49_3_, movietitle3_1_.BUY_USED as BUY3_49_3_, movietitle3_1_.RENT_DOWNLOAD as RENT4_49_3_, movietitle3_1_.BUY_DOWNLOAD as BUY5_49_3_, NVL(movietitle3_.HAS_RENTABLE_PRODUCTS, 0) as formula3_3_ from SUBSCRIPTION_RENTAL subscripti0_ inner join ACTIVE_MOVIE_PRODUCT movieprodu1_ on subscripti0_.MOVIE_ID=movieprodu1_.product_id left outer join PRODUCT_AVAILABILITY movieprodu1_1_ on movieprodu1_.product_id=movieprodu1_1_.MOVIE_ID inner join ACTIVE_MOVIE_PACKAGE moviepacka2_ on movieprodu1_.PACKAGE_ID=moviepacka2_.PACKAGE_ID inner join ACTIVE_MOVIE_TITLE movietitle3_ on moviepacka2_.TITLE_ID=movietitle3_.TITLE_ID left outer join MOVIE_TITLE_ATTRIBUTES movietitle3_1_ on movietitle3_.TITLE_ID=movietitle3_1_.TITLE_ID where subscripti0_.SUBSCRIPTION_ID=:1 and subscripti0_.DATE_CHECK_IN>:2 and (subscripti0_.DATE_CHECK_IN is not null) order by subscripti0_.DATE_CHECK_IN DESC
    Explain Plan for this query:
    OPERATION OBJECT_NAME OPTIMIZER COST BYTES CARDINALITY CPU_COST IO_COST
    SELECT STATEMENT ALL_ROWS 148 1570 5 10090819 147
    SORT 148 1570 5 10090819 147
    NESTED LOOPS 147 1570 5 1237900 147
    NESTED LOOPS 142 1530 5 1191042 142
    NESTED LOOPS 141 1470 5 1174111 141
    NESTED LOOPS 129 1398 6 1073114 129
    NESTED LOOPS 117 1062 6 968996 117
    PARTITION HASH 111 732 6 911328 111
    TABLE ACCESS SUBSCRIPTION_RENTAL ANALYZED 111 732 6 911328 111
    INDEX INDX_SUB_RENTAL_SUB ANALYZED 3 10 43164 3
    TABLE ACCESS MOVIE_PRODUCT ANALYZED 1 55 1 9611 1
    INDEX PK_MOVIE_PRODUCT ANALYZED 0 1 1900 0
    TABLE ACCESS MOVIE_PACKAGE ANALYZED 2 56 1 17353 2
    INDEX PK_MOVIE_PACKAGE ANALYZED 1 1 9021 1
    TABLE ACCESS MOVIE_TITLE ANALYZED 2 61 1 16833 2
    INDEX PK_MOVIE_TITLE ANALYZED 1 1 9021 1
    TABLE ACCESS MOVIE_TITLE_ATTRIBUTES ANALYZED 1 12 1 9331 1
    INDEX PK_MOVIE_TITLE_ATTRIBUTES ANALYZED 0 1 1900 0
    TABLE ACCESS PRODUCT_AVAILABILITY ANALYZED 1 8 1 9371 1
    INDEX PRODUCT_AVAILABILITY_PK ANALYZED 0 1 1900 0
    I need the help very urgently. Kindly give me the solution immediately.
    Edited by: msora on Feb 10, 2009 3:19 AM

    msora wrote:
    Thanks Ozy,
    The query is using joins instead of subquery. The statistics are latest. the query is using indexes too.the optimzer_mode is all_rows.
    Now, you tell me what hint i should use to optimize this query?
    Thanks and Regards,
    MSORAHmm, urgent, immediately, its not Support MSORA. Be patient while asking for help or if its really urgent, open an SR with support.
    Your query is not able to be read. Format it using the { code }( without spaces) and post it. Also there is no such thing that you can just put any hint and query will be tuned. Trace your query with 10046 trace( search this forum for that) and paste its output here.
    Aman....

Maybe you are looking for