Data Dictionary Info for Constraints

Hi,
I want to get Information from the data dictionary about foreign key constraints.
I want to get information about all constraints which REFER to a certain table and column, so I want to get the table/colum which is the parent in a foreign_key realtionship.
I can use ALL_CONS_COLUMNS, but I only get the parent table but not the child table.
Example:
Table A.COLUMN_1 is the parent, there are two foreign key relationships: table B.COLUMN_2 and table C.COLUMN_2, they refer to table A.COLUMN_1.
I want a query which gives me table B and C when I specify table A.COLUMN_1.
Thanks for your help.
Bernhard

-- Dictionary Queries to Determine FK Columns for Given PK
--    note: uses the Ora9i example data in SH schema...
-- Query for Forums user who wanted to query on table_name and column_name
select all pk_cons.constraint_name   pk_constraint
          ,fk_cons.constraint_name   fk_constraint
          ,fk_cons_cols.table_name   fk_table
          ,fk_cons_cols.column_name   fk_columns
from       all_cons_columns   pk_cons_cols
inner join all_constraints   pk_cons
        on pk_cons_cols.owner = pk_cons.owner and
             pk_cons_cols.constraint_name = pk_cons.constraint_name
inner join all_constraints   fk_cons
        on fk_cons.r_owner = pk_cons.owner and
             fk_cons.r_constraint_name = pk_cons.constraint_name
inner join all_cons_columns   fk_cons_cols
        on fk_cons.owner = fk_cons_cols.owner and
             fk_cons.constraint_name = fk_cons_cols.constraint_name
where      pk_cons.owner = 'SH'
and        pk_cons.table_name = 'PRODUCTS'
and        pk_cons_cols.column_name = 'PROD_ID'
-- A better query that uses only table name
select all pk_cons.constraint_name   pk_constraint
          ,fk_cons.constraint_name   fk_constraint
          ,fk_cons_cols.table_name   fk_table
          ,fk_cons_cols.column_name   fk_columns
from       all_constraints   pk_cons
inner join all_constraints   fk_cons
        on fk_cons.r_owner = pk_cons.owner and
             fk_cons.r_constraint_name = pk_cons.constraint_name
inner join all_cons_columns   fk_cons_cols
        on fk_cons.owner = fk_cons_cols.owner and
             fk_cons.constraint_name = fk_cons_cols.constraint_name
where      pk_cons.owner = 'SH'
and        pk_cons.table_name = 'PRODUCTS'
and        pk_cons.constraint_type = 'P'
/

Similar Messages

  • How to find out the aligning Data dictionary table for a structure.

    Hi
    As the table controls are associated with strucures, the data input goes to the data dictionary table aligned to that structure. Is there any way we can find out the table related to that particular structure ?
    Thanks,
    Dhareppa

    Hi,
    The structure and its fields may be associated with multiple database tables.
    You can try by where-used list of the structure/field and then you can look and determine the table by hit and try method.
    Also as suggested above you can try get the SQL trace and then ypu can look for table associated behind the structure/fields I believe this is the best way to find the DB table.
    Thanks,
    Ravi

  • Data Dictionary View for Procedure Text

    Hi,
    Is there a data-dictionary where I can see the body of procedures. In fact, I received a request from a collegue to give him the procedure name which access a table "table_1".
    So, my idea is to write a query as follows:
    SELECT <procedure_name> FROM <data_dictionary> WHERE <text> LIKE '%table_1%'.
    Thanks in advance.

    You can try with DBA_SOURCE or USER_SOURCE.
    i.e.
    SELECT NAME FROM DBA_SOURCE
    WHERE OWNER='<OWNER NAME>'
    AND TYPE='PROCEDURE'
    AND TEXT LIKE '%table_1%';
    Regards,
    Sabdar Syed.

  • Displaying a group of data or info for the given key in a property file

    Hi,
    I have a property file suppose queries.properties.
    it contains the propertys and values as
    profile_1=abc
    profile_2=dfg
    profile_3=ser
    name_1=qwe
    name_2=dfg
    name_3=cbvb
    my requirement is when i pass the key profile then it has to give
    profile_1=abc
    profile_2=dfg like all profile related properties and its values.

    it should display all the profile related keys and its corresponding values.
    the reason behind this requiremnt is to improve the performance .
    if we pass key then at a time we will get the value of that key.
    but if ihave set all the profile related properties and its values then i need to get all at once .

  • Data Dictionary.. Help Please

    I have to create this query for my college course. I need help. I have half of the query, I think. Need another join clause in the from statement for the views, not sure what to do. Any help will be appreciated! Thank you!
    Create and execute a single query of the Oracle data dictionary to display all foreign key constraints in the HR schema. Note that foreign key constraints are constraint type 'R'. For each constraint list the constraint type, constraint name, the referencing table name, the referencing column position(s), the referencing column name(s), the referenced constraint name (i.e. the other table's primary key constraint name), the referenced table, and the referenced column(s). Sort your results by constraint name, table_name, and position.
    HINTS: You will need two different data dictionary views for this query. One of the views will need to be mentioned twice in the FROM clause, and therefore you will need two different aliases. With this arrangement you will also need two join conditions.
    This is what i have so far...
    SELECT uc.constraint_type, uc.constraint_name, uc.table_name, r_constraint_name,
    ucc.table_name, ucc.position, ucc.column_name, ucc.constraint_name
    FROM user_constraints uc JOIN user_cons_columns ucc
    ON uc.table_name= ucc.table_name
    AND uc.constraint_name= ucc.constraint_name
    WHERE constraint_type= 'R'
    AND r_constraint_name IN
    (SELECT constraint_name
    FROM all_constraints
    WHERE constraint_type
    IN ('P','U')
    AND table_name= 'hr')
    ORDER BY uc.constraint_name, ucc.table_name,ucc.position;

    Ok, you have the correct two dictionary views (assuming you are logged in as HR), now you need to figure out which one is needed twice. As a hint, you have the required join columns for the doubled dictionary view in the single use dictionary view.
    A couple of comments on the code you have posted so far.
    The predicate:
    r_constraint_name IN (SELECT constraint_name
                          FROM all_constraints
                          WHERE constraint_type IN ('P','U') AND
                                table_name= 'hr')is unnecessary since by definition, if the constraint type is R, then the r_constraint_column will point to a P (primary key) or U (unique key) constraint.
    By default, all objects in Oracle are stored in the dictionary views in upper case, so when you query a value you need to use upper case for the literal.
    Again, assuming that you are logged in as HR, then the user_xxx views will only show objects that belong to the HR schema, so there is no need to qualify anything with an owner.
    When you are posting code on this site type {noformat}{noformat} before and after your code sample, this will preserve the formatting of your code so it will be more readable.  If you want to see an example of this, click reply to this post and then click the quote button in the reply pane and you will see how I kept the formatting in the snippet above.
    John                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • In which Data Dictionary View I can find ...

    Hello,
    I will do a Overview over all of our Full Backups.
    I am searching in the Data Dictionary Views but I colud not found the right information.
    I could find a nice overview over the last redo log archive etc but no overview over the full backups?!
    In which view I can find these informtaion?
    Thanks in advance!

    Check Summary of RMAN Recovery Catalog Views for the data dictionary views for RMAN.

  • Showing Title and date/time info in exported file

    I am trying to export a group of photos into a file to then compress and e mail. How do I get the title and date/time info for each photo to export as well and be a part of the file?

    You'll need to upgrade to iPhoto 08 or later to write that metadata to the file on export.
    Regards
    TD

  • Add multiple entries to dropdown list without using data dictionary

    Hi,
    By default when we use a data dictionary element for dropdown list, all the possible values are listed in the dropdown. However when no data dictionary element is used for the dropdown list, it behaves like a parameter with a single line.
    I would like to know if it is possible to not use the data dictionary element and still have multiple lines in the dropdown.
    Thanks in advance.
    Shamia

    Check the below program :
    *report zxyz.
    report zxyz.
    Table diclaration
    tables: tvdir.
    Selection screento table View
      selection-screen skip 2.
      parameter p_tabnm(30) as listbox visible length 30 obligatory.
      selection-screen skip 1.
      selection-screen begin of block s1 with frame title text-001.
      parameter: p_radio1 radiobutton group g1,
                 p_radio radiobutton group g1.
      selection-screen end of block s1.
    Add values to list box
    at selection-screen output.
      type-pools: vrm.
      data: name  type vrm_id,
            list  type vrm_values,
            value like line of list.
      name = 'P_TABNM'.
      refresh list.
      value-key = 'V_024'.
      value-text = text-002. "'V_024-Purchasing Groups'.
      append value to list.
      value-key = 'V_T024D'.
      value-text = text-003. "'V_T024D-MRP Controllers'.
      append value to list.
      value-key = 'ZT604'.
      value-text = text-004. "'T604-Commodity Codes'.
      append value to list.
      value-key = 'T179'.
      value-text = text-005. "'T179-Product Hierarchies'.
      append value to list.
      value-key = 'TVM1T'.
      value-text = text-006. "'TVM1T-Business Manager'.
      append value to list.
      value-key = 'TVM2T'.
      value-text = text-007. "'TVM2T-Division manager'.
      append value to list.
      value-key = 'TVM3T'.
      value-text = text-008. "'TVM3T-Director'.
      append value to list.
      value-key = 'V_TVV2'.
      value-text = text-009. "'V_TVV2-Customer Group 2'.
      append value to list.
      call function 'VRM_SET_VALUES'
           exporting
                id     = name
                values = list.
    start-of-selection.
    Get flag of corresponding table view
      select single tabname flag from tvdir into tvdir
                    where tabname = p_tabnm.
    Set flag of corresponding table view
      if p_radio1 eq 'X'.
        if tvdir-flag ne 'X'.
          update tvdir set: flag  = 'X'
                     where tabname = p_tabnm.
        endif.
      endif.
      if p_radio eq 'X'.
        if tvdir-flag eq 'X'.
          update tvdir set: flag  = ''
                       where tabname = p_tabnm.
        endif.
      endif.
    Execute View/Table
      call function 'VIEW_MAINTENANCE_CALL'
        exporting
          action                               = 'U'
          view_name                            = p_tabnm
       exceptions
         client_reference                     = 1
         foreign_lock                         = 2
         invalid_action                       = 3
         no_clientindependent_auth            = 4
         no_database_function                 = 5
         no_editor_function                   = 6
         no_show_auth                         = 7
         no_tvdir_entry                       = 8
         no_upd_auth                          = 9
         only_show_allowed                    = 10
         system_failure                       = 11
         unknown_field_in_dba_sellist         = 12
         view_not_found                       = 13
         others                               = 14.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Reset flag of corresponding table view
      update tvdir set: flag  = tvdir-flag
                    where tabname = p_tabnm.
    Thanks
    Seshu

  • Date/time info

    Previous versions of PSE have displayed the date/time info for each image in the organiser.  PSE 11 doesn't do this.  Does anyone know where I can change settings so that it does - this info is very usefu to me.

    Go to View menu >> detail .
    Or Press Ctrl (commnad)+D

  • What is the data dictionary for direcoty objects?

    Dear All,
    I would like to know the data dictionary for directory objects. Or where i can get more details of directory objects.
    Thanks in advance
    Balaji

    Hi,
    YOu can use dba_directories view to get info about directory.
    For other views
    1.select * from tab where tname like '%DIRECT%';
    2.select * from dictionary where table_name like '%DIRECT%';
    Regards
    Jafar

  • Data Dictionary for Flatfiles?

    Hi everyone,
    Is there a document out there for the data dictionary of the flat files?
    I found "BIAPPSDMRV796_RevA.pdf", which is the data model/data dictionary for the OBAW tables. But it doesn't contain the info for the flat files (at least I haven't found the flat files in there yet).
    thanks for the help!
    -Joe

    Based on what has been said so far, you understanding is correct.
    But I've been talking with some colleagues and I believe i am not actually going to modify the existing Universal Connectors.
    The reason being are the following:
    1) The existing connectors already have metadata created in the DAC that will run them. If I copy and paste them into my "custom" universal connectors, then I will need to find a way to hook up these new ETLs into the DAC.
    2) If there were ever updated versions of the Universal Connectors, then I would have to first, import the new version. Then make a copy. Then apply my custom changes to the copy.
    3) If I ever wanted to pick this solution up and hand it to someone else, having based upon the standard BI Apps ETLs will make this more portable.
    What I do plan on doing is making a custom ETL folder for ETLs that populate the flat-files. This method makes sure that if the logic in the Universal connectors ever changes, my code is virtually unaffected (barring changes to the flat-file structure). On top of that, I could hand someone the Informatica XML in a completely different BI Apps environment and they could import it and get up and running very fast without having to impact the out of the box code from Oracle.
    -Joe

  • SQL for data dictionary report

    Hi, anyone know what SQL I would need to run to to get a basic data dictionary listing? ie I'd like to know:
    table_name, column_name, column_type, length, precision, nullable etc
    Also a nested sub-query to get each tables constraints, indexes etc
    Thanks,
    Andrew

    The tables you'll need are user_table, user_tab_columns, user_indexes, user_ind_columns (maybe user_ind_expressions to if you use function based indexes), user_constraints and user_cons_columns.
    Personally, I find that calling DBMS_METADATA.GET_DDL for the object(s) is easier most of the time.

  • I have a Iphone4s and just brought a new Iphone 6 when I pluged the the new phone all my data wastransfered exepet for my ring tones all other info photos,music and contacts all downloaded ok but no ring tone how can i get them to come across to the

    I have a Iphone4s and just brought a new Iphone 6 when I pluged the the new phone all my data wastransfered exepet for my ring tones all other info photos,music and contacts all downloaded ok but no ring tone how can i get them to come across to the new phone

    This covers all the process
    Transfer content from an iPhone, iPad, or iPod touch to a new device - Apple Support

  • How to run sql scripts using batch file for a web dynpro data dictionary

    Hi,
    I want to develop a sql script to be executed on the server alongwith the installation of a product to pre-populate web dynpro data dictionary tables required for the application.
    I further require to make the scripts independent of the database name,so that it can be run at any client environment.
    Your help will be appreciated and rewarded.

    See shoblock's answer
    call sql script from unix
    masterfile.sql:
    @file1 &1
    @file2 &2
    @file3 &3
    @file4 &4
    then just call the master script:
    sqlplus userid/password @masterfile <p1> <p2> <p3> <p4>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Tracking Changes for Single record in Data Dictionary

    Hi Experts,
    I encountered with this question in an interview. I was asked how to maintain/track changes for a particular single record in a Data Dictionary table. I knew that for an entire table we can do it using table maintenance events. But I was confused when the interviewer asked for one particular record in table. Kindly input your thoughts on this.
    Thanks.

    Hi Radhika,
    In case of record in a table we can use "log data changes" option (Table DBTABLOG) in Technical Settings > Log data changes. It enable writing of change documents in Tables CDHDR/CDPOS.
    Hope this helps.
    Regards,
    Naveen

Maybe you are looking for