TRACING RELATIONSHIP BETWEEN TABLES....

Hello all,
I use the below query to find the hierarchial relationship between tables ...
SELECT
c.table_name parent_table , c.column_name parent_column,b.table_name child_table ,b.column_name child_COLUMN ,LEVEL lrv
FROM USER_constraints a,user_cons_columns b ,user_cons_columns c
WHERE a.constraint_name = b.constraint_name
AND a.r_constraint_name = c.constraint_name
AND constraint_type = 'R'
AND b.table_name <> 'CNTRCT_PARENT'
START WITH b.table_name = 'CNTRCT_PARENT'
CONNECT BY NOCYCLE PRIOR b.table_name = c.table_name
ORDER BY c.table_name
but i need order like below,
parent table childtable1
childtable1 grantchildtable1
childtable1 grantchildtable2
parent table childtable2
childtable2 grantchildtable1
childtable2 grantchildtable2
childtable2 grantchildtable3
how this sort of order by is possible ...
Thanks in advance
Vijay G

Hi,
Try
ORDER SIBLINGS BY ...

Similar Messages

  • Relationship between tables in a module(urgent)

    Hi ,
    Am new to this domain(SAP)...
    I want to move datas to SAP through codes...
    For example,i want to add datas to ItemGroups module of Inventory module....But it failed...On the other hand,i was able to add datas to Item table of the same module...
    i think there is someother table to which ItemGroups is related..Could anyone kindly help me in finding out these type of relationship between tables in a moduel at ease?
    Hoping for your quick reply,
    Thanks

    hi
    I think in your scnario data is fetching from material valuation table based on material number (MBEW-MATNR), through document segment material table (MSEG-MATNR).
    Based on you company material management flow, your scenario is based.
    hope this helps
    thank you.

  • Query to find all relationships between tables

    Please help me wit the following
    Query to find all relationships between tables
    SAMPLE OUTPUT:
    PRIMTAB PRIMCOL FOREIGNTAB FOREIGN KEY
    DEPT DEPTNO EMP DEPTNO
    Return all records in the database.
    PLEASE HELP

    SET LINESIZE 150
    COLUMN primcol FORMAT A30
    COLUMN foreigncol FORMAT A30
    SELECT uc1.table_name AS primtab,
    ucc1.column_name AS primcol,
    uc2.table_name AS foreigntab,
    ucc2.column_name AS foreigncol
    FROM user_constraints uc1,
    user_constraints uc2,
    user_cons_columns ucc1,
    user_cons_columns ucc2
    WHERE uc1.constraint_name = uc2.r_constraint_name
    AND uc1.constraint_name = ucc1.constraint_name
    AND uc2.constraint_name = ucc2.constraint_name
    AND ucc1.position = ucc2.position
    ORDER BY uc1.table_name,
    ucc1.position
    /

  • ONE-to-MANY relationship between tables and forms in APEX

    I recently started using APEX and I have run into an issue.
    I have a ONE-TO-MANY relationship between two tables, A1 and A2, respectively.
    A1:
    A1_ID
    Item
    A2:
    A2_ID
    SubItem
    A1_ID
    I have 2 forms (lets call it F1 and F2) that I use to capture data for A1 and A2.
    On F2, I have the following fields that are setup to capture data:
         A2.A1_ID
    **A1.Item (this is a drop down that is populated using a SELECT statement where the select uses A1.Item field)
         A2.SubItem (user would enter SubItem)
    Note: A2.A2_ID is populated using a SEQ
    Everytime I pick **A1.Item on F2, is there a way to link to A1 table and display A1.A1_ID for every **A1.Item selected on F2?
    If so, I want to store the value captured in F2 for the A1_ID field into A2 table to maintain my 1-to-MANY relationship.
    If this will work, how do I go about implementing this solution?
    Can someone help me?

    I think it sounds like you are asking for a Master-Detail form. Try that and see what you get.
    chris.

  • Relationship between table

    hi,
    iam having two tables BVOS, MODELS
    how to know the relationship between this two tables

    user9093689 wrote:
    sry dude
    i can find the ddl for those tables but i cannot find any foriegn key relationship.Then you're off to the races with option 2 i told you about before.
    Ask someone who works where you do. If no one implemented tables with foreign keys, the guessing game begins. Have fun.

  • Relationship between  table (bsad,bsid) to faglflexa table

    Hi Gurus,
    this is very urgent,
    I am developing report for profit centre collections.
    how i establish relationship between bsad or bsid to faglflexa.
    faglflexa having docnr, docln and belnr,buzei in these doccument numbers which i will consider(docnr or belnr) to build relationship between bsad to faglflexa.
    if any one know  please send me the answer
    Regrds,
    Shashikumar.G
    Message was edited by:
    Shashikumar Guntuka
    Message was edited by:
            Shashikumar Guntuka

    Hi one of the options to consider to avoid multiple lines in FAGLFLEXA against one customer open item is to activate Document split by Profit Center, in the new GL
    With document split documents in FAGLFLEXA will be like:
    Customer 300
    Rev PC -300
    Customer 200
    Rev PC2 -200
    Instead of the standard one, that are causing your issue:
    Customer +500
    Rev PC1 -300
    Rev PC2 -200
    hope it helps

  • Relationship between tables

    HI all;
    I need to get the following fields into my ODS.
    1. cost center
    2. activity type
    3. version
    5. Fiscal year
    6. Posting Period
    7. Activity Qty1
    8. Activity Qty2
    9 Activity Qty12.
    I see these fields are stored in the following table
    1. CSKS
    2. COSL
    3. CSLA
    when I created a view there is no relationship exits between these tables. Please guide me through how to create the relationship if I have to include another table which is the appropriate one for my scenario.
    thank you.

    Hi,
    you also need to take into account the table cssl. This is the link between cost centers and activity types, so between csks and csla. Now have a look into the content of table cosl. I guess the objnr contains costcenter and activity type concatenated together with some other information, --> KL<co_area><cost_center><activity_type>.
    regards
    Siggi

  • Relationship between Table BKPF and RBKP

    Hello Developers,
    I need to fetch value of field BKTXT  from table BKPF and this value need to insert in internal table i_tab.
    in the below situation:
    select bebeln bebelp bwerks ausnam alifnr abelnr
             abldat abudat
             caedat cekgrp cbukrs cekorg
             dbanfn dbnfpo dnetpr dafnam
      into corresponding fields of table i_tab
      from rbkp as a join rseg as b on abelnr = bbelnr
                     join ekko as c on bebeln = cebeln
                     join ekpo as d on cebeln = debeln
                                          and bebelp = debelp
      where a~budat in s_date
        and b~werks in s_werks
        and c~bstyp = c_f
        and c~ekorg in s_ekorg
        and a~bukrs in s_bukrs.
    Can any one suggest how to relate table BKPF with other table like RBKP.
    Thanks in advance.
    Regards
    Sundeep

    Hi,
    perform the following steps:-
    1.   Go to transaction SQVI
    2.   Create a View
    3.   Enter title
    4.   Choose the Data source as Table Join
    5.   Go to insert table and add table as per your requirement.
    and hereafter you can find relation between any two tables...
    Rgds/Abhi

  • Relationship between tables..Please.

    Hi SRM folks,
      I am working on EBD-SAP BW project, I have problem of primary key please look at my scenario.
    I have a view( ZBW_SHOPCART : View for extracting Shopping Cart data to BW),
    in turn the view is built on the following tables:
    1)  CRMD_ORDERADM_H : Business Transactions CRM                                                       
    2)  CRMD_ORDERADM_I  : Business Transaction Item                                                      
    3)  BBP_PDBEI  :  Backend Specific Item Data                                                                  
    4)  CRM_JEST   :  Individual Status per Object
    common primary key is GUID and MANDT
    According to the current  Requirements 
    We need to Enhance the view ZBW_SHOPCART  with the following table fields
    Step Name : Table   SWWWIHEAD : Workflow Runtime: Header Table for All Work Item Types
                              Field     WI_TEXT
    Status          :   Table   SWWWIHEAD
                              Field    WI STAT
    Results       : Table SWDSTEXT : Workflow definition: Language-dependent texts
                           Field WFD_TEXT
    Date            :   Table   SWWWIHEAD
                             Field    WI_CD
    Time          : Table   SWWWIHEAD
                          Field   WI_CT
    Agent       :   Table   SWWWIHEAD
                         Field   WI_AAGENT
    Problem :  There is no common( Primary key ) key between the tables SWWWIHEAD,  SWDSTEXT and the View ZBW_SHOPCART to join the tables with the View.
    Folks please suggest me in this regard, are there any ways to join the tables SWWWIHEAD and  SWDSTEXT with the view
    I will wait for your valuable suggestion,
    thank you
    DJ

    Hi,
    Currently we are extracting the data from EBP to SAP BW based on the view
    <b>ZBW_SHOPCART : View for extracting Shopping Cart data to BW</b>
    is containing the tables & fields as follows
    Tables:
            CRMD_ORDERADM_H
            CRMD_ORDERADM_I
             BBP_PDBEI
             CRM_JEST
    Field                Table
    CLIENT              -CRMD_ORDERADM_H
    HEADER_GUID      -CRMD_ORDERADM_H
    OBJECT_ID      -CRMD_ORDERADM_H
    ITEM_GUID      -CRMD_ORDERADM_I
    STAT              -CRM_JEST
    INACT              -CRM_JEST
    CHGNR              -CRM_JEST
    DESCRIPTION      -CRMD_ORDERADM_H
    CREATED_AT      -CRMD_ORDERADM_H
    BE_OBJECT_ID      -BBP_PDBEI
    CHANGED_AT      -CRMD_ORDERADM_H
    now Current requirement is to enhance that view with some more fields as follows
    Step Name : Table   SWWWIHEAD : Workflow Runtime: Header Table for All Work Item Types
                              Field     WI_TEXT
    Status          :   Table   SWWWIHEAD
                              Field    WI STAT
    Results       : Table SWDSTEXT : Workflow definition: Language-dependent texts
                           Field WFD_TEXT
    Date            :   Table   SWWWIHEAD
                             Field    WI_CD
    Time          : Table   SWWWIHEAD
                          Field   WI_CT
    Agent       :   Table   SWWWIHEAD
                         Field   WI_AAGENT
    I need to join this fields into the view, am not able to see the common( Primary key ) key.
    Please help me
    Message was edited by:
            Jangareddy dasari
    Message was edited by:
            Jangareddy dasari
    Message was edited by:
            Jangareddy dasari

  • Relationship between tables while using inner joins.

    Hi,
    I had a few clarifications on "inner joins", and as i was going through the forum, i came across two points,
    1. In one of the threads it said " inner joins is applicable for tables that have a parent child relationship.
    2. In another thread it said " inner join is established from master table (the table on the left) to the transcation table (the table on the right)".
    I have two clarifications based on the above points.
    1. Is it necessary that the tables on which im performing an inner join should have a parent-child/children relationship or is it enough that the tables just have a common field.
    2.  Also is it necessary that the master table should come first, (or can i use any child table from where i can fetch the records when there is a mater table in my report) as shown below.
    Eg: select * <fields> from <master table> inner join <table> on <field> into <itab>.
    Edited by: Narayananchandran on Dec 27, 2010 12:31 PM

    have two clarifications based on the above points.
    1. Is it necessary that the tables on which im performing an inner join should have a parent-child/children relationship or is it enough that the tables just have a common field.
    2. Also is it necessary that the master table should come first, (or can i use any child table from where i can fetch the records when there is a mater table in my report) as shown below.
    Eg: select * <fields> from <master table> inner join <table> on <field> into <itab>
    1) NO
                      2) NO

  • Relationship Between tables in ECC

    Hi Experts,
           I have to generate one report which is belongs to Purchasing, Meterial and Delivery. I need to findout the relation between  MSEG and MBEW, these two tables are belongs to Meterial.
        I found MATNR in both the tables but I found mamy records for MSEG-MATNR in MBEW-MATNR. I couldn't find on which basis they are posting the data into two tables.
        So what is the relation between these two tables. And let me know the relation between PURCHASING, METETIAL AND DELIVERY.
    Please can anyone give the complete details.
    Thank you,
    VCREDDY.

    hi
    I think in your scnario data is fetching from material valuation table based on material number (MBEW-MATNR), through document segment material table (MSEG-MATNR).
    Based on you company material management flow, your scenario is based.
    hope this helps
    thank you.

  • How to find the relationship between tables

    Hi All
    I am working in oracle apps R12 in OM and INV and i am new. Is there any document for getting the all key tables and the relationship of the tables.
    Thanks & Regards
    Srikkanth.M

    Hi;
    You need to check e-trm site to can see table explaniation,integrity,relations etc
    Check:
    etrm.oracle.com
    Regard
    Helios

  • Relationship between tables milestone and wbs element

    Hi  Guys,
    1.I have taken two tables in my source code retieving milestone number(mlst_zaehl), usage(mlstn),and wbs element(pspsnr)
    from TABLE MLST and the other table is PRPS(WBS ELEMENT TABLE, and the fields are psphi(project) , and pspnr(wbs elemrnt,
    The problem is i am not getting the project (psphi)  FROM PRPS TABLE and the link field is PRPS-PSPNR = MLST-PSPNR.
    2.Other requiremnt is  in the same program, iam getting reservation quantity and also DELIVERY QUANTITY
    if delivery qty equal to reservation quantity then exit  and if the reservation qty is NOT equal to delivery qty,
    i need to UPDATE the corressponding USAGE , MILESTONE TEXT, AND QTY in milestone table MLST.
    please let me know any function to update milestone or BAPI or i sahll use BDC.
    Reagrds
    subbara

    Hi
    I think you want to link MLST and PRPS tables to get the milestone fields...
    From Table MLST - Mile stone number - MLST_ZAEHL and WBS element - PSPNR, link the WBS elements with PRPS table - WBS element - PSPNR and for project - PSPHI (Current Project Number).
    For project number you can take from PRPS - PSPHI or from PROJ table
    - Pithan

  • Find the relationship between tables where the constraint type is 'R'

    Hello,
    I am trying to find an answer of the following question:
    How to query the user_constraints view (probably some more views should be involved here) in order to get information about the table name, the column (or columns) that is (are) a foreign key to another table, the name of the referenced table, and the name of the referenced column (or columns) and finally the name of the FK. And additionally, if the referenced table from the first row has its own constraints of type 'R', then to have this table in the second row, where this same table stands in the first column. Each table that is a participant in this tree, of course, could have one or many FK to other tables. One does not know this at run time.
    A predicate to say with which table to start the search from will look like this:
    <pre>
    user_constraints.table_name = 'my_table_name'
    </pre>
    So, if you could help by providing at least hints for such a query, I will be glad to see different answers.
    Thanks :)

    Thanks a lot for the answer!
    That will work and is a very useful starting point.

  • Relationship between tables CRMD_ORDERADM_H and BBP_PDORG

    Hi all,
    I need to search all the RFx for a certain condition.
    In the transaction BBP_PD i can see that the header table is CRMD_ORDERADM_H and the table for org. data is BBP_PDORG.
    But the guid of both tables are different.
    Do you know how I can relate the two tables?
    Thanks in advance !

    Hello Husalban,
    SELECT set_guid FROM bbp_pdorg
    SELECT guid_hi FROM crmd_link WHERE guid_set = bbp_pdorg-set_guid
    SELECT header FROM crmd_orderadm_i WHERE guid = crmd_link-guid_hi
    SELECT object_id process_type FROM crmd_orderadm_h WHERE guid = crmd_orderadm_i-header
    Regards.
    Laurent.

Maybe you are looking for

  • Mass Upload of object dependency for characteristics value

    Hi ,   I need to upload the object dependency for characteristics values through transaction CT04. My input data consists of characteristcs name , characteristics value and the object dependency (KNNAM) . Need to populate the KNNAM field alone . Have

  • Need to know the event when an individual recipient is sent Mail

    i can successfully sent mail through Java Mail API to multiple recipients but on display i want to show end-user progress like " mail sent to recipient:ID (ith out of n recipients)" I want to know if any event is fired when an individual recipient is

  • DataGrid Item Renderer loading duplicates after scroll

    HI, I have a report that loads into a datagrid, these reports are about thumbnail images that are on a server. I have a datagrid item renderer that loads the thumb nails. When the grid first loads the first set of rows that are visible display the co

  • Error in Shuttles - leading:items has been tampered.

    Hi folks , I am facing the below error in a page, when we select any value from the LOV. "You are trying to access a page that is no longer active. - The referring page may have come from a previous session. Please select Home to proceed." To give a

  • Migration Assistant crashing

    Looking for assistance here. Have an older iMac 24" 8.1 2.8GHz Intel Core 2 Duo (1TB drive) which is running 10.9.4 . Just opened the box today to my new iMac 27" 5k retina 3.5GHz Quad-core Intel Core i5 (3TB fusion drive) which is running 10.10 Anyw