Query to display the tables with referential integrity

Hello,
I need to display the Tables which are having referential integrity..
Like need to dispaly the parent and child tables
Please give me some idea on this..
Thanks,

Here's a nice query you can use:
with temp_constraints as (
select table_name
,      constraint_name pkey_constraint
,      null fkey_constraint
,      null r_constraint_name
from   user_constraints
where  constraint_type = 'P'
union all
select a.table_name
,      a.constraint_name pkey_constraint
,      b.constraint_name fkey_constraint
,      b.r_constraint_name
from   user_constraints a, user_constraints b
where  a.table_name = b.table_name
and a.constraint_type = 'P'
and b.constraint_type = 'R'
select rpad( '*', (level-1)*2, '*' ) || table_name relation
from   temp_constraints
start with fkey_constraint is null
connect by pkey_constraint <> r_constraint_name
and prior  pkey_constraint = r_constraint_name;From http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:661009003696#tom69115451356231

Similar Messages

  • Tables with referential integrity

    Hi All,
    I am generating scripts to insert data from one schema to another. something like this:
    Insert into schemaA.table1
    select *from schemaB.table1;There are many tables with referential integrity in the schema. how can generate the scripts in an order so that there
    won' t be any referential integrity issue....
    Thanks.
    AJR

    Hi,
    Thanks.
    I tried, but it gives me 6 sets of data.
    SELECT TABLE_NAME--, LTRIM(SYS_CONNECT_BY_PATH(TABLE_NAME, '=>'),'=>') TABLE_NAME_PATH,CONSTRAINT_NAME, R_CONSTRAINT_NAME, LEVEL
    FROM   USER_CONSTRAINTS,ALL_OBJECTS B
    --WHERE  LEVEL > 1
    WHERE
    USER_CONSTRAINTS.OWNER = B.OWNER AND
    USER_CONSTRAINTS.TABLE_NAME = B.OBJECT_NAME AND
    B.OBJECT_TYPE = 'TABLE'
    CONNECT BY R_CONSTRAINT_NAME = PRIOR CONSTRAINT_NAME
    ORDER BY TABLE_NAME;AJR

  • Can I display the table content of a web page??

    Hi guys I am new to java and here I need to count the words in each table and display the table with largest number of words . This being a part of my huge project. Below is my code where I have succeeded in displaying all the tables present in the web page.But I need to count all the words in the table and display only that table which has largest number of words including all the tags. So java experts please help me with this piece of code...................
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.util.regex.*;
    public class findtable{
      public static void main(String[] args) {
        String inputLine = null;
        String wholeHtml = "";
    int trcount=0;
        try{
          URL yahoo = new URL("http://books.google.com/books?q=+subject:%22+Science+Fiction+%22&as_brr=3&rview=1&source=gbs_hplp_fict");
          URLConnection yahooConnection = yahoo.openConnection();
          BufferedReader br = new BufferedReader
            (new InputStreamReader(yahooConnection.getInputStream()));
          int start = 0;
          while ((inputLine = br.readLine()) != null) {
            wholeHtml += inputLine;
            if (inputLine.contains("<table")){
                      ++start;
            if (start != 0) {
              System.out.println(inputLine);
            if (inputLine.contains("</table>")) {
              --start;
        catch (MalformedURLException me) {
           System.out.println("MalformedURLException: " + me);
        catch (IOException ioe) {
          System.out.println("IOException: " + ioe);
        }So any help would be really really appreciated....
    The code should take care of nested tables also..
    So guys looking forward for the generous help....

    I have already parsed the HTML and checked all the closing of tags and corrected the indent using Tidy and then I have applied this code so some other suggestions please

  • Display all the rows in the table with Varray

    I created two Varrays
    CREATE TYPE phone_varray AS VARRAY(3) OF NUMBER(10);
    CREATE TYPE email_varray AS VARRAY(3) OF varchar2(30);
    CREATE TABLE ee
    (id number(2),
    phone phone_varray);
    now i inserted some rows into ee table and displayed it as:
    SELECT e1.id,e2.COLUMN_VALUE"PHONE NO" FROM ee e1,TABLE(e1.phone) e2;
    ID PHONE NO
    1 1111111111
    1 2222222222
    1 3333333333
    1 1111111111
    1 2222222222
    1 4444444444
    4 1111
    4 2222
    4 33334
    5 1111
    5 2222
    5 33334
    Then i altered the table with email_varray
    desc ee;
    Name Null? Type
    ID NUMBER(2)
    PHONE PHONE_VARRAY
    EMAIL EMAIL_VARRAY
    I updated some rows:
    update ee e1 set email=email_varray('aasda') where id=4;
    and when i try to display the table data by:
    SELECT id,e2.*,e3.* from ee e1,TABLE(e1.phone) e2,TABLE(e1.email) e3;
    it only displays the rows that contain all the details like
    ID COLUMN_VALUE COLUMN_VALUE
    4 1111 aasda
    4 2222 aasda
    4 33334 aasda
    and not all the rows that are in the table which have id and phone and email as NULL
    need help to display all the rows in the table.

    will this work for you ?
    SELECT e1.id,e2.COLUMN_VALUE as PHONE_NO, null as email FROM ee e1,TABLE(e1.phone) e2
    union
    SELECT e1.id,null,e3.column_value as email from ee e1, TABLE(e1.email) e3;

  • Associted two table where referential integrity constraint is  present

    SELECT A.COLUMN_NAME,A.CONSTRAINT_NAME,B.CONSTRAINT_TYPE,A.TABLE_NAME FROM USER_CONS_COLUMNS A,USER_CONSTRAINTS B
    WHERE A.OWNER=B.OWNER
    AND A.OWNER='TEST'
    AND A.TABLE_NAME=B.TABLE_NAME
    AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME
    AND A.TABLE_NAME='CN_SMSC'
    from this query we can get name of the column ,const name,type and associated sigle table name.
    my question is
    ==============
    how will i get associted two table where referential integrity constraint is present

    SELECT A.COLUMN_NAME,A.CONSTRAINT_NAME,B.CONSTRAINT_TYPE,A.TABLE_NAME "Detail Table", b.R_CONSTRAINT_NAME , c.TABLE_NAME "Primary table"
    FROM user_CONS_COLUMNS A,user_CONSTRAINTS B, user_constraints c
    WHERE A.OWNER=B.OWNER
    AND A.OWNER='TEST'
    AND A.TABLE_NAME=B.TABLE_NAME
    AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME
    and b.CONSTRAINT_type ='R'
    and c.CONSTRAINT_NAME = b.R_CONSTRAINT_NAME
    AND A.TABLE_NAME='CN_SMSC'

  • Error when displaying the table

    hellow,
        here i have to .htm pages, in first page i am entering the table name, and it has to display the table details in second page.
    but in second page i am getting error like field catalog not found
    plz help me.
    with regards
    babu

    hi babu rs
    Please post the code of the two bsp page with the layout as well as abap code. Only than anybody can help you.

  • Making particular rows as non editable before displaying the TABLE

    Hi everyone,
                               I would like to know how to make a particular rows as non editable in UI element "TABLE" before it is displayed . The scenario is :
    On entering the Personnel number, I am getting family dependants in the table. Then, I am selecting any of the family members on some condition and saving each member with the request.
    Next time when i enter the same personnel number, I would like to show the table with already saved request for the family members rows as non editable & other members row as editable.????
    Please provide a feasible solution.

    Hi Pradeep,
    follow as per suggested. if not work use cell variants concept. it will work.
    Please check this wiki...
    http://wiki.sdn.sap.com/wiki/display/WDABAP/WebDynproforABAPCellVariants
    Cheers,
    Kris.

  • Deletion of duplicates in the table with out using rowid

    How can I delete duplicates in the table with out using ROWID .

    hi
    sleect count(coulmnname),columnname from table
    group by columnname
    having count(columnname) > 1;
    find the primary key of the table
    apply the below query
    delete from table
    where (primary key,repeated column name )
    not in
    ( select min(primary key), repeated column
    from employee group by repeated column );
    use this in the primary key column use empid ,,,the repated column is ename
    empid ename
    1 sankar
    2 sankar
    try this one

  • Give me the sql query which calculte the table size in oracle 10g ecc 6.0

    Hi expert,
    Please  give me the sql query which calculte the table size in oracle 10g ecc 6.0.
    Regards

    Orkun Gedik wrote:
    select segment_name, sum(bytes)/(1024*1024) from dba_segments where segment_name = '<TABLE_NAME>' group by segment_name;
    Hi,
    This delivers possibly wrong data in MCOD installations.
    Depending on Oracle Version and Patchlevel dba_segments does not always have the correct data,
    at any time esp. for indexes right after being rebuild parallel (Even in DB02 because it is using USER_SEGMENTS).
    Takes a day to get the data back in line (never found out, who did the correction at night, could be RSCOLL00 ?).
    Use above statement with "OWNER = " in WHERE for MCOD or connect as schema owner and use USER_SEGMENTS.
    Use with
    segment_name LIKE '<TABLE_NAME>%'
    if you like to see the related indexes as well.
    For partitioned objects, a join from dba_tables / dba_indexes to dba_tab_partitions/dba_ind_partitions to dba_segments
    might be needed, esp. for hash partitioned tables, depending on how they have been created ( partition names SYS_xxxx).
    Volker

  • Join the Table with View

    Hi,
    My doubt is can I join the table with view in the below where clause condition in the query. If yes, the below query will take 4 hrs to execute it. Can I do the below query to write as simplest?
    SELECT *
      FROM uabpymt p, uavlsum l
    WHERE uabpymt_appl_ind = 'N'
       AND uabpymt_amount > 5
       AND l.uavlsum_balance < 0
       AND l.uavlsum_cust_code = p.uabpymt_cust_code
       AND l.uavlsum_prem_code = p.uabpymt_prem_codeuavlsum ---view
    uabpymt ---table
    The view script below:
    CREATE OR REPLACE VIEW UAVLSUM
    (UAVLSUM_CUST_CODE, UAVLSUM_PREM_CODE, UAVLSUM_AMOUNT, UAVLSUM_BALANCE)
    AS
    SELECT cust_code,
           prem_code,
           SUM(amount),
           SUM(balance)
    FROM (
    SELECT uabopen_cust_code cust_code,
           uabopen_prem_code prem_code,
           uabopen_billed_chg amount,
           uabopen_balance balance
    FROM   uimsmgr.uabopen
    UNION ALL
    SELECT uabpymt_cust_code,
           uabpymt_prem_code,
           uabpymt_amount * -1,
           uabpymt_balance * -1
    FROM   uimsmgr.uabpymt
    UNION ALL
    SELECT uabadje_cust_code,
           uabadje_prem_code,
           uabadje_balance,
           to_number(0)
    FROM   uimsmgr.uabadje
    WHERE  uabadje_balance <> 0)
    GROUP BY cust_code,
             prem_code

    Find the below explain plan output which we get from the execute the query
    STATEMENT_ID            TIMESTAMP     REMARKS        OPERATION     OPTIONS          OBJECT_NODE OBJECT_OWNER            OBJECT_NAME            OBJECT_INSTANCE      OBJECT_TYPE OPTIMIZER      
                16/01/2009 05:57:24                   SELECT STATEMENT                                                                                                                           RULE                                                                                                                                                   
                16/01/2009 05:57:24                   FILTER                                                                                                                                                                                                                                    
                16/01/2009 05:57:24                   SORT           GROUP BY                                                                                                                                                                                                                      
                16/01/2009 05:57:24                   TABLE ACCESS           BY INDEX ROWID                     UIMSMGR                     UABPYMT                                1                                             
                16/01/2009 05:57:24                   NESTED LOOPS                                                                                                                                                                                                                                  
                16/01/2009 05:57:24                   VIEW                                                   UIMSMGR                                                         3                                             
                16/01/2009 05:57:24                   UNION-ALL                                                                                                                                                                                                                              
                16/01/2009 05:57:24                   TABLE ACCESS           FULL                            UIMSMGR                     UABOPEN                                    4                                             
                16/01/2009 05:57:24                   TABLE ACCESS           FULL                            UIMSMGR                     UABPYMT                                    5                                             
                16/01/2009 05:57:24                   TABLE ACCESS           FULL                            UIMSMGR                     UABADJE                                    6                                                                                                                                                         
                16/01/2009 05:57:24                   INDEX       RANGE SCAN                                   UIMSMGR                     UABPYMT_CUST_PREM_INDEX                        NON-UNIQUE                                                                                                                           
    Index column:
    Table name :UABPYMT
    Column Name
    UABPYMT_APPL_IND  
    UABPYMT_APPROVED_IND    
    UABPYMT_PYMT_DATE          
    UABPYMT_SOURCE    
    UABPYMT_ORIGIN                   
    UABPYMT_CUST_CODE          
    UABPYMT_PREM_CODE         
    UABPYMT_PYMT_DATE          
    UABPYMT_AR_TRANS             
    UABPYMT_GL_IND                  
    UABPYMT_GL_POST_DATE     
    UABPYMT_AR_TRANS  

  • Mapping between the query/report and the role with technical names - BI Sec

    Hi,
    How to find the mapping between the query/report and the role with technical names ?
    Like in R/3 we can find the mapping using table AGR_TCODES or thourgh SUIM. However in BI all reports have tcode RRMX.
    So. how to find the role for a given query/report like sales report with technical names?

    I looked into this quite a while ago and cannot remember the exact details, but I think there were 3 tables needed together with a structure to explore with a function module, and you need to use the program ID to think them.
    If you look in SQ01 then I am sure you will find one of the tables, and then search from there onward.
    Alternately, while searching you might find a nice report which does this for you.
    Hope that helps and let us know whether you find it.
    Cheers,
    Julius

  • Mapping between the query/report and the role with technical names

    Hi,
    How to find the mapping between the query/report and the role with technical names ?
    Like in R/3 we can find the mapping using table AGR_TCODES or thourgh SUIM. However in BI all reports have tcode RRMX.
    So. how to find the role for a given query/report like sales report with technical names?
    Edited by: Phoenix on Jul 26, 2008 4:15 PM

    Posted in wrong forum

  • Very Important (Query to display the output in required format)

    CREATE TABLE TEMP(X VARCHAR2(10),Y VARCHAR2(100));
    INSERT INTO TEMP('RIDER1','2001-12;2002-32;2003-42');
    INSERT INTO TEMP('RIDER2','2001-52;2003-72');
    SELECT * FROM TEMP
    Initial Out Put in 2 columns X/Y_
    X Y
    RIDER1 2001-12;2002-32;2003-42
    RIDER2 2001-52;2003-72
    Write a Query to display the above data in the format below in 3 columns A/B/C*
    A B C
    Rider1 2001 12
    Rider1 2002 32
    Rider1 2003 42
    Rider2 2001 52
    Rider2 2003 72

    So your old version doesn't support Regular expression. It will be very easy and efficient if you could use regular expression.
    SQL> SELECT x,TRIM(REGEXP_SUBSTR(col2,'[^-]+', 1, 1)) col2,
      2           TRIM(REGEXP_SUBSTR(col2,'[^-]+', 1, 2)) col3
      3   FROM (
      4     SELECT DISTINCT x,regexp_substr (y, '[^;]+', 1, level) col2 
      5     FROM temp 
      6     CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (y, '[^;]+'))  + 1
      7     ORDER BY 1,2
      8        );
    X          COL2
    COL3
    RIDER1     2001
    12
    RIDER1     2002
    32
    RIDER1     2003
    42
    X          COL2
    COL3
    RIDER2     2001
    52
    RIDER2     2003
    72But for your version you can use something like
    SQL> /* By curtesy Frank Kulash */
    SQL> SELECT x,SUBSTR(the_value,1,INSTR(the_value,'-',1)-1) col2,
      2           SUBSTR(the_value,INSTR(the_value,'-',1)+1)col3
      3  FROM (
      4        SELECT DISTINCT x,SUBSTR(y,
      5                            DECODE(level,
      6                                   1,
      7                                   1,
      8                                   INSTR(y, ';', 1, level - 1) + 1),
      9                            DECODE(INSTR(y, ';', 1, level),
    10                                   0,
    11                                   length(y),
    12                                   instr(y, ';', 1, level) -
    13                                   DECODE(level,
    14                                          1,
    15                                          0,
    16                                          INSTR(y, ';', 1, level - 1)) - 1)) the_value
    17                FROM temp
    18              CONNECT BY level <=
    19                         LENGTH(y) - LENGTH(REPLACE(y, ';')) + 1
    20          )
    21  ORDER BY 1,2,3                     
    22       ;
    X          COL2
    COL3
    RIDER1     2001
    12
    RIDER1     2002
    32
    RIDER1     2003
    42
    X          COL2
    COL3
    RIDER2     2001
    52
    RIDER2     2003
    72
    SQL>

  • Displaying the table based on number of records.

    Hi Experts,
    I want to display a normal table based on the records, if there is only one record then only one row should be displayed on the table, if there are 2 records then 2rows should be displayed on the table with the data, if they are more than 2 records only 2 rows should be displayed on the table and remaining rows should be able to scroll on the table.
    Please Provide the requried infformation.
    Thanks & Regards.
    Bhushan.

    Hi Bhushan
      What exactly is row scroll? Did you not refer to the vertical scrollbar that appears when the number of rows is more than the number of displayed rows? Please clarify
    If it is the vertical table scroll bar you refered to then you will get it if the number of records are more than the visibleRowCount you set
    If it is the horizonal table scroll bar you refered to then you will get it by setting a fixed width to the table. If your column(s) value width exceeds the table width you have specified, you get the horizontal scrollbar.
    Regards,
    Gayathri Shanbhag

  • For for updating database with referential integrity

    Hi:
    Here is the essence of the problem:
    I have created an Access database that I want the fire chiefs
    to update. The database is a one to many structure with referential
    integrity set. One fire truck has many capabilities. So if Fort
    Myers has a truck named 'FM101' and it has several capabilities
    such as 1.) pumper, 2.) extrication 3.) Advanced Life Support.
    My problem is how to set up a form to do that. In particular,
    how do I set up the form so that it will allow the fire chiefs to
    input several capabilities at a time for a truck.
    I can build a form showing the truck which was obtained from
    a pick-list. And I can show another field showing a pick-list for
    the capability of that truck (pumper, extrication, ALS, etc). My
    question is how do I set up the form to allow the chiefs to input
    multiple lines for the many capabilities of that one truck? Right
    now I have one input for the truck and one input for the capability
    - but I want to enable the user to input as many capabilities as
    they feel necessary.
    How do I do that?
    thanks

    You put the capabilities in a multi-select box.
    <select name="capabilities" multiple="true">
    <option value="capability1">Capability 1</option>
    </select>

Maybe you are looking for

  • User Error message keeps appearing when trying to download itunes V7

    Hiya, Just brought a brand spanking new Ipod Video 30gb. As there is no installation cd I had to go online and download itunes. However, everytime I try to download i keep getting a message as follows - "Could not open key: HKEYLOCALMACHINES\Software

  • EDI customer specific mappings

    Hello Experts, I am having a scenario where the old legacy system is planned to be replaced by PI (7.11)-Seeburger. Now the old system based out of Gentran had around 100 maps pertaining to their 100 customers for distribution of their Invoices and A

  • Data Guard Logical Standby DB Questions

    Hi, I am creating Oracle 9i Logical Standby database on AIX 5 on same server ( for testing only ). In Data Guard Manual ( PDF file page no : 86 ) it is said that Step 4 Create a backup copy of the control file for the standby database. On the primary

  • How to hide the display of  my text in oracle forms

    Oracle Forms 6i Hai All My question is how to disable my Text. I have created a forms for weight management here when the user opens the forms I dont want to show my text and textitem before filling some fields. I have have set the text item by Set_i

  • Looking for BLANK artwork plug-in

    I'm not looking for a plug-in that will get artwork for me, I'm looking for a way to filter on songs that do not have any album art. Kind of like the 'show duplicates' feature in iTunes lets you see where you may have multiple copies of the same song