OWB - possible to use connect by prior in mappings

Hi,
We get data supplied in hierarchical table and like to populate column on downstream table with level in hierarchy (parent, child or grandchild).
In sql can use connect by prior.
Is it possible to use this in mapping?
Thanks

Check this:
https://blogs.oracle.com/warehousebuilder/entry/connect_by_in_owb_10gr2_hierar

Similar Messages

  • How to get the root node for a child using connect by prior

    Hi,
    I searched at many places to do this but not able to get the exact o/p sp posting my question here.
    I have a table with parent_id and child_id columns. The levels of this parent_child can be many but my aim is to find the ultimate parent ( dont know the right term)
    like if I have a child_node= xyz and its parent= pqr and its parents=lmn which might be ultimate parent which doesnt have any further parent.
    So if i start with child_code= "xyz" then i should get the parent as "lmn" and not the immediate parent "pqr".
    Please help.
    Thanks,
    Aashish

    To find the Parent on emp table:
    select empno,ename,level
    from emp
    where level=3
    start with empno=7934
    connect by  empno= prior mgrTo find the Child on emp table:
    select empno,ename,level
    from emp
    where level=1
    start with empno=7934
    connect by prior empno=  mgrBut you need to know the level or position to specify the level of parent or child. But there are some other possible options available if we can know the requirement properly.
    Edited by: Vasista on Jan 11, 2011 2:27 AM
    Edited by: Vasista on Jan 11, 2011 2:30 AM

  • Query tuning for query using connect by prior

    I have written following query to fetch the data. The query is written in this format because there are multiple rows, which make one recrd and we need to bring that record into one row.
    For one CAT(commented here), this query takes around 4 minutes and fetches 6900 records but when it runs for 3 CAT, it takes 17 mins.
    I want to tune this as this has to run for 350 CAT values.
    It is doing FTS on the main table. I tried to use different hints like PARALLEL, APPEND (in insert) but nothing worked.
    The cost of the query is 51.
    Any help/suggestions will be appreciated.
    SELECT DISTINCT MIN(SEQ) SEQ,
    PT, APP, IT, LR, QT,CD, M_A_FLAG,
    STRAGG(REM) REM, -- aggregates the data from different columns to one which is parent
    CAT
    FROM (WITH R AS (SELECT CAT, SEQ, PT, M_A_FLAG, IT, LR,QT,CD, REM, APP
    FROM table1
    WHERE REC = '36' AND M_A_FLAG = '1'
    --AND CAT = '11113')
    SELECT CAT, SEQ,
    CONNECT_BY_ROOT PT AS PT,
    CONNECT_BY_ROOT APP AS APPL,
    M_A_FLAG,
    CONNECT_BY_ROOT IT AS IT,
    CONNECT_BY_ROOT LR AS LR,
    CONNECT_BY_ROOT QT AS QT,
    CONNECT_BY_ROOT CD AS CD,
    REM
    FROM R A
    START WITH PT IS NOT NULL
    CONNECT BY PRIOR SEQ + 1 = SEQ
    AND PRIOR CAT = CAT
    AND PT IS NULL)
    GROUP BY PT, APP, IT,LR, QT, CD, M_A_FLAG, CAT
    ORDER BY SEQ;
    Thanks.
    Edited by: user2544469 on Feb 11, 2011 1:12 AM

    The following threads detail the approach and information required.
    Please gather relevant info and post back.
    How to post a SQL tuning request - HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long - When your query takes too long ...

  • Hierarchical query with out using Connect by prior

    Hi Guys,
    I am supporting a product which is enterprise based and only allowd to write queries which are ANSII standard.
    I have an requirement like If I provide the child I need to know all the parents till  highest level.
    My table structure is like below
    Table_name :  Org_unit
    Columns are
    Org_unit_id name desc  parent_org_unit_id
    I wil pass the org_unit id and want to list all the parents of the chile org_unit_id and it has to be accomplished without  using connec by prior.
    Please suggest me some ideas and aprroches
    I am using Orcle 11g version

    Hi,
    960593 wrote:
    Hi Guys,
    I am supporting a product which is enterprise based and only allowd to write queries which are ANSII standard.
    I have an requirement like If I provide the child I need to know all the parents till  highest level.
    My table structure is like below
    Table_name :  Org_unit
    Columns are
    Org_unit_id name desc  parent_org_unit_id
    I wil pass the org_unit id and want to list all the parents of the chile org_unit_id and it has to be accomplished without  using connec by prior.
    Please suggest me some ideas and aprroches
    I am using Orcle 11g version
    The data model you posted (org_unit_id as primary key, parent_org_unit_id as foreign key to the same table for the parent, when there is a parent) is called the Adjacency Model because it keeps track of which nodes are adjacent (or next to) each other.
    I'm familiar with 2 other ways to model hierarchies: the Nested Sets Model, and what I call the Lineage Model.  I'll show how to find a given node's ancestors (in hierarchical order) in each model.  Neither the Nested Sets nor the Lineage Model requires CONNECT BY or recursive WITH clauses to work.
    The following table contains all the columns necessary for using each of these 3 models:
         EMPNO        MGR ENAME      LINEAGE                    NS_LOW NS_HIGH
          7839            KING       /7839/                          1      28
          7698       7839 BLAKE      /7839/7698/                     2      13
          7499       7698 ALLEN      /7839/7698/7499/                3       4
          7900       7698 JAMES      /7839/7698/7900/                5       6
          7654       7698 MARTIN     /7839/7698/7654/                7       8
          7844       7698 TURNER     /7839/7698/7844/                9      10
          7521       7698 WARD       /7839/7698/7521/               11      12
          7782       7839 CLARK      /7839/7782/                    14      17
          7934       7782 MILLER     /7839/7782/7934/               15      16
          7566       7839 JONES      /7839/7566/                    18      27
          7902       7566 FORD       /7839/7566/7902/               19      22
          7369       7902 SMITH      /7839/7566/7902/7369/          20      21
          7788       7566 SCOTT      /7839/7566/7788/               23      26
          7876       7788 ADAMS      /7839/7566/7788/7876/          24      25
    The Lineage Model keeps track of all of a given nodes ancestors, so if all you need to find are the primary keys of a given node, it's really trivial: it's all in the lineage column.  If you want to find more information about those ancestors, then you can do a self-join, like this:
    SELECT    a.empno, a.ename, a.lineage
    FROM      emp  a
    JOIN      emp  d   ON  d.lineage  LIKE '%/' || a.empno || '/%'
    WHERE     d.ename  IN ('ADAMS')
    ORDER BY  d.ename
    ,         a.lineage
    Output:
         EMPNO ENAME      LINEAGE
          7839 KING       /7839/
          7566 JONES      /7839/7566/
          7788 SCOTT      /7839/7566/7788/
          7876 ADAMS      /7839/7566/7788/7876/
    The Nested Sets model is harder to understand.
    Imagine everyone in the hierarchy standing on a wide staircase, as if for a group picture; everyone on the same level standing on the same step.  Everyone is holding up an umbrella that is wide enough to cover himself and all the people who are under him in the hierarchy.  The people with no underlings have small umbrellas, denoted like this "<-SMITH->", and peole that manage others have bigger umbrellas, like this: <-------- JONES -------->.  So the group picture might look like this:
    <-------------------------------------------- KING --------------------------------------------->
      <---------------------- BLAKE --------------------->  <-- CLARK -->  <-------- JONES -------->
       <-ALLEN-> <-JAMES-> <-MARTIN-> <-TURNER-> <-WARD->    <-MILLER->     <-- FORD--> <--SCOTT-->
                                                                             <-SMITH->   <-ADAMS->
    Each parent's umbrella covers all of his descendants (children, grandchildren, etc.), and nobody else.
    Now draw vertical lines trom the edges of each umbrella downwards, and number those lines from left to right:
    <-------------------------------------------- KING ------------------------------------------------>
    |                                                                                                  |
    | <---------------------- BLAKE --------------------->  <-- CLARK ->   <-------- JONES ----------> |
    | |                                                  |  |          |   |                         | |
    | |<-ALLEN-> <-JAMES-> <-MARTIN-> <-TURNER-> <-WARD->|  |<-MILLER->|   |<-- FORD--> <--SCOTT---> | |
    | ||       | |       | |        | |        | |      ||  ||        ||   ||         | |          | | |
    | ||       | |       | |        | |        | |      ||  ||        ||   ||<-SMITH->| |<-ADAMS-> | | |
    | ||       | |       | |        | |        | |      ||  ||        ||   |||       || ||       | | | |
                                               1 1      11  11        11   112       22 22       2 2 2 2
    1 23       4 5       6 7        8 9        0 1      23  45        67   890       12 34       5 6 7 8
    The numbers corresponding to the left arnd right edges of each umbrella are what I called ns_low and ns_high in the table.  Each employyes ns_low and ns_high numbers will be inside the range of each of his ancestors ns_low and ns_high.
    To find the ancestors of a given node in the nested set model you can do this:
    SELECT   a.empno, a.ename, a.ns_low, a.ns_high
    FROM   emp  a
    JOIN      emp  d  ON  d.ns_low  BETWEEN  a.ns_low
                                    AND      a.ns_high
    WHERE     d.ename  IN ('ADAMS')
    ORDER BY  d.ename
    ,         a.ns_low
    Both the Lineage and Nested Sets models are good for tree structures only, whereas the Adjacency Model can handle other kinds of graphs, including graphs with loops.
    Both the Lineage and Nested Sets models can be very difficult to maintain if the hierarchy is re-organized.
    I'd like to repeat some of the warnings that others have made.  You could write separate code for each system (Oracle, SQL Server, ...) that you want to run in, and the code for each system will be more or less different.  You're looking for some code that will get the same results in all systems.  That code will be more complicated that the most complicated of the single-system versions, and it will be sloweer than the slwoest of the single-system versions.  You're giving up a lot of functionality, and probably also ease of maintenance, by writing code that has to work on multiple systems without changes.
    Here's how I created the emp table shown above from scott.emp:
    CREATE TABLE    emp
    AS
    WITH    connect_by_results  AS
        SELECT  empno, mgr, ename
        ,       LEVEL   AS lvl
        ,       ROWNUM  AS r_num
        ,       SYS_CONNECT_BY_PATH (empno, '/') || '/'   AS lineage
        FROM scott.emp
        START WITH mgr IS NULL
        CONNECT BY mgr = PRIOR empno
        ORDER SIBLINGS BY ename
    SELECT empno, mgr, ename, lineage
    ,       (2 * r_num) - lvl            AS ns_low
    ,       (2 * r_num) + ( 2 * (
                                    SELECT  COUNT (*)
                                    FROM    connect_by_results
                                    WHERE   lineage  LIKE '%/' || cbr.empno || '/%'
                        - (lvl + 1)      AS ns_high
    FROM connect_by_results   cbr
    This relies on the fact that the hierarchy in scott.emp has only one root (that is, a node with no parent).  Computing the Nested Sets numbers is a little more complicated if you can have multiple roots.

  • Problem Creating a query for a hierarchical tree. [using connect by prior]

    Hi all,
    I have 2 tables.
    box (box_id, box_name)
    item(item_id, item_name, box_id)
    In a box there are several items.
    I want to create a hierachical tree to display items that are present in each box.
    LIKE:
    |---BOX1
    | |----ITEM 1
    | |----ITEM 2
    |
    |---BOX2
    | |----ITEM 1
    | |----ITEM 2
    Currently i am trying this query:
    SELECT -1 state, box_name, 'icon' icon, box_id val
    from box b, item i;
    I don't know what value to put for level, i don't know how to code the 'connect by prior' part.
    Could you please advise me?
    Michaël.
    PS. Then i will eventually use this query in forms builder.

    Note the name of this forum is "SQL Developer *(Not for general SQL/PLSQL questions)*" - so only for issues with the SQL Developer tool. Please post these questions under the dedicated SQL And PL/SQL forum.
    Regards,
    K.

  • To remove  duplicate  data using connect by prior

    Hi ,
    I want to details of the employee whom reporting to without duplication .
    In table data,one employee reporting to two employees.so that reporting to process is coming two times.
    Query:
    SELECT lpad(' ', (level - 1) * 2) || EMPLOYEE_NAME as EMP_NAME,SUP_BU AS BU_CODE,SUP_REP_BU,EMP_NO,EMPLOYEE_NAME,LEVEL AS THE_LEVEL
    FROM ATTD_REPORT_TO_VW
    WHERE EMP_NO IS NOT NULL
    CONNECT BY PRIOR SUP_BU = SUP_REP_BU
    START WITH SUP_BU = :p_bu
    BUT i get the duplicate data,SUPPOSE i remove the duplication using distinct keyword ,the order of hierarchical is going wrong.
    Pls provide the solution.
    Thanks ,
    Maran

    plz ask this question in seperate SQL/PLSQL forum and also provide more information with sample data

  • How to use simple SQL instead of Connect By Prior

    Currently, I am using "connect by prior" query in the application, but for reason I don�t want to use this connect by query so can any one please tell how does I get the same result by using SQL, I tried this by using procedure but unable to get the same result, specially LEVEL of the tree.
    So please tell, how would I get the correct data.
    Thanks in advance,
    AMIT.

    Hi,
    Whenever you have a question, it helps to post:
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables
    (3) The results you want from that data
    (4) Your best attempt so far (formatted) I don't believe the unformated code you posted is what you're really running, since it has a syntax error ("... WHERE START WITH ..."). Please post code that really works with the sample data you posrted.
    (5) The full error message (if any), including line number
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    If you can present your problem using commonly available tables (for example, scott.emp, which contains a hierarchy), then you can omit (2).
    Formatted tabular output is okay for (3). Type these 6 characters
    &#123;code&#125;
    (small letters only, inside curly brackets) before and after the tabular text, to preserve spacing.
    As Alex said, why don't you want to use CONNECT BY?
    Are you getting the correct results now, but just looking for a different way of getting them?
    Depending on your exact requirements, you could write a PLSQL function that mimics LEVEL. Don't expect it to be fast.
    Nested Sets is a completely different way of modeling trees.
    Some things are much easier with Nested Sets than they are using the Adjacency Model (the parent-child model that uses CONNECT BY).
    But some things are much harder with Nested Sets, and LEVEL is one of them.

  • MODEL clause using CONNECY BY PRIOR

    Hello.
    I have the following table, CONTEXT_MAPPING:
    Name Null? Type
    ID NOT NULL NUMBER(38)
    CONTEXT_ITEM NOT NULL VARCHAR2(30)
    ID_1 NUMBER(38)
    ID_2 NUMBER(38)
    ID_3 NUMBER(38)
    ID_4 NUMBER(38)
    ID_5 NUMBER(38)
    It's a self referencing table, i.e. ID_1 will refer to an ID from another row in CONTEXT_MAPPING, and the same for ID_2/3/4/5.
    Easily illustrated through the following hierarchical data:
    ID CONTEXT_ITEM ID1 ID2 ID3 ID4 ID5
    1 P_DMA_NDA_ID
    2 P_DS_NDA_ID 1
    3 P_AST_NDA_ID 2 1
    4 P_AGI_ID 3
    5 P_ASG_NDA_ID 3
    6 P_NTS_FACTS 5 5
    7 P_IDE_VALUE 2 1
    8 P_EIT_VALUE 2 1
    9 P_TRI_TABLE 4 6 7 8
    10 P_TRI 9
    11 P_PRICE1 6 10 6
    12 P_PRICE2 6 10 6
    What I want to do, is for any context item, to identify ALL of its dependencies throughout the tree.
    For example:
    P_PRICE2 has a link to P_NTS_FACTS (ID1 & ID3 = 6) and P_TRI (ID2 = 10)
    P_NTS_FACTS has a link to P_ASG_NDA_ID (ID1 & ID2 = 5), which in turn links to P_AST_NDA_ID (ID1 = 3)...
    P_TRI has a link to P_TRI_TABLE (ID1 = 9), which in turn links to multiple context items (ID1 = 4, ID2 = 6 etc.) ....
    ....and so on, until we get to the "root" record, P_DMA_NDA_ID.
    So, to see the complete dependency tree for P_PRICE2, I would expect to see a hierarchical result-set like this:
    ID CONTEXT_ITEM ID1 ID2 ID3 ID4 ID5
    12 P_PRICE2 6 10 6
    10 P_TRI 9
    9 P_TRI_TABLE 4 6 7 8
    4 P_AGI_ID 3
    6 P_NTS_FACTS 5 5
    5 P_ASG_NDA_ID 3
    3 P_AST_NDA_ID 2 1
    7 P_IDE_VALUE 2 1
    8 P_EIT_VALUE 2 1
    2 P_DS_NDA_ID 1
    1 P_DMA_NDA_ID
    Ideally I want to do this in a single SQL statement - I've tried using CONNECT BY PRIOR in conjunction with LEVEL to do this, but it only performs a hierarchical join for a single child-parent relationship, and I need this to work for up to five children.
    Was starting to wonder if I could use the MODEL clause in conjunction with CONNECT BY PRIOR to achieve this - does anyone have any idea whether this type of recursion is possible?
    Thanks,
    Ray

    it only performs a hierarchical join for a single child-parent relationshipBeg to differ.
    Oracle Database 10g Release 10.2.0.2.0 - Production
    SQL> CREATE TABLE context_mapping (
      2     id NUMBER(38),
      3     context_item VARCHAR2(30),
      4     id_1 NUMBER(38),
      5     id_2 NUMBER(38),
      6     id_3 NUMBER(38),
      7     id_4 NUMBER(38),
      8     id_5 NUMBER(38));
    Table created.
    SQL> INSERT INTO context_mapping VALUES (1, 'P_DMA_NDA_ID', NULL, NULL, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (2, 'P_DS_NDA_ID', 1, NULL, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (3, 'P_AST_NDA_ID', 2, 1, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (4, 'P_AGI_ID', 3, NULL, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (5, 'P_ASG_NDA_ID', 3, NULL, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (6, 'P_NTS_FACTS', 5, 5, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (7, 'P_IDE_VALUE', 2, 1, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (8, 'P_EIT_VALUE', 2, 1, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (9, 'P_TRI_TABLE', 4, 6, 7, 8, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (10, 'P_TRI', 9, NULL, NULL, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (11, 'P_PRICE1', 6, 10, 6, NULL, NULL);
    1 row created.
    SQL> INSERT INTO context_mapping VALUES (12, 'P_PRICE2', 6, 10, 6, NULL, NULL);
    1 row created.
    SQL> SELECT DISTINCT id, context_item, id_1, id_2, id_3, id_4, id_5
      2  FROM   context_mapping
      3  START WITH id = 12
      4  CONNECT BY id IN (PRIOR id_1, PRIOR id_2, PRIOR id_3, PRIOR id_4, PRIOR id_5)
      5  ORDER BY id DESC;
            ID CONTEXT_ITEM                         ID_1       ID_2       ID_3       ID_4       ID_5
            12 P_PRICE2                                6         10          6
            10 P_TRI                                   9
             9 P_TRI_TABLE                             4          6          7          8
             8 P_EIT_VALUE                             2          1
             7 P_IDE_VALUE                             2          1
             6 P_NTS_FACTS                             5          5
             5 P_ASG_NDA_ID                            3
             4 P_AGI_ID                                3
             3 P_AST_NDA_ID                            2          1
             2 P_DS_NDA_ID                             1
             1 P_DMA_NDA_ID
    11 rows selected.
    SQL>

  • CONNECT BY PRIOR on 9i

    This 9i SQL Reference indicates that it is possible to combine CONNECT BY PRIOR with a join predicate.
    In 8i I get the following error:
    ORA-01437 cannot have join with CONNECT BY
    Cause: A join operation was specified with a CONNECT BY clause. If a CONNECT BY clause is used in a SELECT statement for a tree-structured query, only one table may be referenced in the query.
    Action: Remove either the CONNECT BY clause or the join operation from the SQL statement.
    I can't find documentation to test the obvious hypothesis - comments?

    My alternative solutions.
    ***Sample***
    ID  PrevID
    1    null
    2       1
    3       1
    4       3
    ***output which we want***
    ID  PrevID  isLeaf
    1    null       0
    2       1       1
    3       1       0
    4       3       1
    ***DDL***
    create table CloneIsLeaf as
    select 1 as ID,null as PrevID from dual
    union select 2,1 from dual
    union select 3,1 from dual
    union select 4,3 from dual;
    --method1
    select ID,PrevID,
    case when exists(select 1 from CloneIsLeaf b
                      where a.ID = b.PrevID) then 0 else 1 end as isLeaf
      from CloneIsLeaf a
    Start With ID = 1
    connect by prior ID = PrevID;
    --method2
    select ID,PrevID,
    case when Level < Lead(Level) over(order by RowNum)
         then 0 else 1 end as isLeaf
      from CloneIsLeaf
    Start With ID = 1
    connect by prior ID = PrevID;
    --method3
    select ID,PrevID,
    case when LV < Lead(LV) over(order by RowNum)
         then 0 else 1 end as isLeaf
    from (select ID,PrevID,Level as LV
            from CloneIsLeaf
          Start With ID = 1
          connect by prior ID = PrevID
          order siblings by ID);
    --method4
    select ID,PrevID,
    case when LV < Lead(LV) over(order by Row_Num)
         then 0 else 1 end as isLeaf
    from (select ID,PrevID,LV,RowNum as Row_Num
            from (select ID,PrevID,Level as LV
                    from CloneIsLeaf
                  Start With ID = 1
                  connect by prior ID = PrevID
                  order siblings by ID));on method2 and method3 and method3,
    I used that "Hierarchical Queries" is depth-first search (http://en.wikipedia.org/wiki/Depth-first_search)
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/queries003.htm#i2053935
    my site :-)
    http://www.geocities.jp/oraclesqlpuzzle/10-149.html

  • Connect by prior problem with order by

    Hi,
    I and using connect by prior within a query on Oracle 8 and would like to order the results within the parent levels.
    All the documentation that I have read shows that in Oracle 9i there is an option to say order siblings by which looks like what I need, but this does not work on Oracle 8.
    Can anyone tell me how I can order the children within the parents without changing the tree structure?
    I have also tried SYS_CONNECT_BY_PATH and I just get an error saying that it is an invalid column name,

    Karen, see here for a dicussion on how to order the siblings in a pre-9i environment:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:9212348049

  • Connect by prior performance

    In our application, we have a lot of 'trees' in our data (parent/child relationships within a table). We rely heavily on 'connect by prior' to search through the trees, to find for example values that are defined in one of the parents ('inheritance').
    Lately however, we've been eliminating connect by priors wherever we can lately, because performance is dramatic. No matter what indexes we use, we keep getting full tablescans on large tables because of the connect by priors. Views with 2 connect by priors are deadly for performance.
    What is a good way to optimize connect by priors?
    As an example of why we use connect by prior, consider this:
    table A
    ID   PARENT_ID   NAME    LENGTH
    1    NULL        root    10
    2    1           child   NULLWe consider record 2 'derived' from record 1, inheriting its length. The alternative for connect by prior is to populate the child length whenever the master length changes, and this is what we do in most situations now, but it's hell to keep track of this. If a record changes, you would still have to go down the tree to change all child lengths etc, so we rather use connect by prior.
    Any ideas?

    Ivo, would you please post the table definition (if different than your example), the actual list of indexes, a sample query, and the explain plan for that query?
    I use hierarchical queries extensively on tables with millions of rows. They work very well if all the pieces are in place. Let's see if we can get your queries humming...

  • Connect by Prior - ORA-00600: internal error code, arguments: [kkqcbydrv:1

    Hi,
    We are writing some complex query using Connect by Prior in it.
    When we execute this query on same version of database as that of our client, then the query is executing.
    But when we execute this query at client's side then it raises error -
    ORA-00600: internal error code, arguments: [kkqcbydrv:1] , [] , [] , [] , [] , [] , [] , []
    After searching on metalink,
    We could find two workarounds -
    1. Use a /*+no_unnest*/ hint, but this may have perfomance implications.
    2. alter session set "_optimizer_connect_by_cost_based"=false;
    of which we cant use second workaround as this query is called from a application and not directly from oracle prompt.
    We are working with the first workaround, but what is wondering us is that,
    If same query can work well on our side then why is this query not performing in same way at client's side?
    We are using same version of database, same amount of data is present in development and production databases.
    Then what is causing this error only in priduction?
    Any help in this regard is appreciated.
    Thanks,
    Av.

    You can use the second tip in a database login trigger. But if the metalink ORA-600 diagnostic tool can only give you those workarounds I suggest raising a SR to try and get the bug fixed.
    It may be differing patch levels that cause the difference between the two sites, some subtle difference in temp tablespace, a corrupt block - impossible for us to say but maybe not for Oracle.

  • Connect by prior usage restricted to certain level in an hierarchy.

    Hi,
    I had a requirement where the values are stored in a hierarchial basis in a database table. The hierarchy is upto five levels. When I use connect by prior, its using all the five levels to evaluate. But I want to restrict the evaluation upto only three levels. So can anyone help me out in resolving the issue. I would like to know how we restrict, the usage to only say, two or three levels.
    Any help is highly appreciated.
    Thanks and Regards,
    Venky.

    Just add AND LEVEL < 4 to CONNECT BY clause. For example:
    SQL> select lpad(' ',(level-1)*2) || level || ' ' || ename as ename
      2    from emp
      3    start with mgr is null
      4    connect by prior empno = mgr
      5        and level < 4;
    ENAME
    1 KING
      2 JONES
        3 SCOTT
        3 FORD
      2 BLAKE
        3 ALLEN
        3 WARD
        3 MARTIN
        3 TURNER
        3 JAMES
      2 CLARK
    ENAME
        3 MILLER
    12 rows selected.
    SQL> SY.

  • Connect by prior in disco

    Hi
    I have a table in Oracle which is a recursive (pigs ear) hierarchy. I want to be able to use this in disco and "wander" down the hierarchies using connect by prior and start with. Can this be done?

    Not sure if you're referring to a specific table.
    However, I have create a report in the past that simply pointed to a database view we created that used the connect by idea and all worked well.
    So, if you have a database view that returns what you're needing then no problem.

  • CONNECT By Prior...or something else...

    I have a very simple audit table with the following format:
    Input_File Varchar2(256)
    Output_File Varchar2(256)
    Date
    The table basically keeps tracks of files going through my systems. At a later point in processing, what was an Output_File for record 1, can be the Input_File of record two. If a single Input_File generates several output files, then a second branch would be generated based upon that output file name. Here are a few example records - I have only shown an example of only 1 branch:
    Row Input_File Output_File
    1 RWMS.00024928.DAT RWMS.00024928.DAT
    2 RWMS.00024928.DAT 943RWMS.00024928.DAT
    3 943RWMS.00024928.DAT CA943RWMS.00024928.DAT.presort
    4 CA943RWMS.00024928.DAT.presort CA943RWMS.00024928.DAT
    (I have intentionally left Date out of this example.)
    What I am trying to do is find the first Input_File with an associating Output_File. When I need this information, it will be based upon the final output filename; which in this case is the file CA943RWMS.00024928.DAT. So, in this case the orignal input filename is RWMS.00024928.DAT.
    Currently, I am using the option 'CONNECT BY Prior' to link Input_File of row 4 to Output_File of Row 3 and so on. This works OK when there are not too many records in the table. However, when the table gets pretty big, the query takes longer and longer to run.
    Is there a more efficient method than using 'CONNECT BY Prior'? If so, how would I go about writing the SQL to do that?
    Regards,
    Richard.

    Faheem1 wrote:
    FATHER, CHILD_NUM, CODE, CODE_QTY
    a 1 b 1
    b 1 c 1.5
    c 1 d 2
    d 1 e 1
    There are 3 columns father,child_num,code & the code_quantity.
    It is explained as 'a' is my FINAL finished good and is produced from raw material 'b' using 1kg.
    and here 'b' becomes my finished good and is produced from raw material 'c' using 1kg.
    and here 'c' becomes my finished good and is produced from raw material 'd' using 1kg.
    and here 'd' becomes my finished good and is produced from raw material 'e' using 1kg.how much of 'a' is produced from raw material 'b' using it 1 kg? is it 1 kg itself....??
    And also what values 1,1.5,2.1 specify in above table...
    If everything is 1:1 is product:rawmaterial ratio then 20kg of 'a' requires 20 kg of 'e'
    Ravi Kumar
    Edited by: ravikumar.sv on Nov 6, 2009 1:38 PM

Maybe you are looking for

  • How can I build automatically jar with Eclipse?

    Hi, I try to build automatically jar file each time when I save my project.Until now I used right click and Export to jar but that take me more time and it is not efficiently.I have try to configure an new builder from project->properties-> builders

  • Display rows affected data from MySQL statement??

    Hi, Im trying to get the return data from a MySQL database, such as the ROWS AFFECTED into after an INSERT sql command. Could anyone help me? I mean I know its easy in PHP to use the "mysql_affected_rows" command, but how do you do this in Java? Many

  • Security Update 2010-007 freezes MacBookPro with grey screen and spinner

    Just some observations: a client with a MacBook Pro (2GHz Duo Core, 1.5Gb RAM) was running 10.5.8 without issue. Applied the Security Update 2010-007, Java Update 8, iTunes 10.0.1 and Safari 5.0.2. Rebooted, and machine kernal panics. Restarted twice

  • DVD Audio Problem in main video

    I have a 94 minute video clip that i am try to burn to dvd; however, when I burn the project i get a dvd that all the menu's work but the main video only has audio for the first 15 minutes and last 5 minutes. The video has been encoded to a quicktime

  • Trying to set up Icloud! Helpp!

    I am trying to set up Icloud with my computer and my Iphone but when i go into iTunes to click music and other boxes to set up icloud it tells me that my computer isnt authorized. What does that mean and how do i fix it??