How to find  out child tables given a parent table /parent's constraint_nam

Hi
I need to disable a primary key but is not able to becoz of referential constraint
select child_constraint.table_name, child_constraint.constraint_name, child_detail.column_name
from user_cons_columns child_detail
join user_constraints child_constraint
on child_detail.constraint_name = child_detail.constraint_name
and child_detail.owner = child_detail.owner
and child_detail.table_name= child_detail.table_name
where child_constraint.constraint_type='R'
and child_constraint.status='ENABLED'
and child_constraint.r_constraint_name='SUBSCRIBER_PK';
and child_detail.table_name='ADDRESS_BOOK_GROUP';
Given a table name how would I know all the child tables and the child tables' columns referencing the parent keys?
thanks

thanks for the reply
while the first query is correct
select child_constraints.table_name child_table_name, child_detail.constraint_name child_constraint_name
, child_detail.column_name child_column_name, child_constraints.constraint_type child_constraint_type
, child_constraints.status, parent_constraints.table_name parent_table_name, parent_detail.column_name parent_column_name
, parent_constraints.constraint_name parent_constraint_name
, parent_constraints.status parent_constraint_status from
user_cons_columns child_detail
join user_constraints child_constraints
on child_detail.constraint_name=child_constraints.constraint_name
and child_detail.owner=child_constraints.owner
and child_detail.table_name=child_constraints.table_name
join user_constraints parent_constraints
on parent_constraints.constraint_name=child_constraints.r_constraint_name
join user_cons_columns parent_detail
on parent_detail.constraint_name=parent_constraints.constraint_name
and parent_detail.owner=parent_constraints.owner
and parent_detail.table_name=parent_constraints.table_name
where
child_constraints.r_constraint_name in (
select constraint_name from user_constraints parent_constraint
where parent_constraint.constraint_type='P'
and parent_constraint.status='ENABLED'
and parent_constraint.table_name='SUBSCRIBER'
and child_constraints.constraint_type='R'
and parent_constraints.constraint_type='P'
--and child_constraints.status='ENABLED'
order by child_constraints.table_name
, child_detail.position
the second query return a lots of garbage why is this so?
select child_constraints.table_name child_table_name, child_detail.constraint_name child_constraint_name
, child_detail.column_name child_column_name, child_constraints.constraint_type child_constraint_type
, child_constraints.status, parent_constraints.table_name parent_table_name, parent_detail.column_name parent_column_name
, parent_constraints.constraint_name parent_constraint_name
, parent_constraints.status parent_constraint_status from
user_cons_columns child_detail
join user_constraints child_constraints
on child_detail.constraint_name=child_constraints.constraint_name
and child_detail.owner=child_constraints.owner
and child_detail.table_name=child_constraints.table_name
join user_constraints parent_constraints
on parent_constraints.constraint_name=child_constraints.r_constraint_name
join user_cons_columns parent_detail
on parent_detail.constraint_name=parent_constraints.constraint_name
and parent_detail.owner=parent_constraints.owner
and parent_detail.table_name=parent_constraints.table_name
where
child_constraints.constraint_type='R'
and parent_constraints.constraint_type='P'
--and child_constraints.status='ENABLED'
order by child_constraints.table_name
, child_detail.position
thanks

Similar Messages

  • How to find out when data was deleted from table in oracle and Who deleted that

    HI Experts,
    Help me for below query:
    how to find out when data was deleted from table in oracle and Who deleted that ?
    I did that to fidn out some data from dba_tab_modifications, but I m not sure that what timestamp shows, wether it shows for update,insert or delete time ?
    SQL> select TABLE_OWNER,TABLE_NAME,INSERTS,UPDATES,DELETES,TIMESTAMP,DROP_SEGMENTS,TRUNCATED from dba_tab_modifications where TABLE_NAME='F9001';
    TABLE_OWNER                    TABLE_NAME                        INSERTS    UPDATES    DELETES     TIMESTAMP         DROP_SEGMENTS TRU
    PRODCTL                        F9001                                                     1683         46       2171            11-12-13 18:23:39             0                   NO
    Audit is enable in my enviroment?
    customer is facing the issue and data missing in the table and I told him that yes there is a delete at 11-12-13 18:23:39 in table after seeing the DELETS column and timestamp in dba_tab_modifications, but not sure I am right or not
    SQL> show parameter audit
    NAME                                 TYPE        VALUE
    audit_file_dest                      string      /oracle/admin/pbowe/adump
    audit_sys_operations                 boolean     TRUE
    audit_syslog_level                   string
    audit_trail                          string      DB, EXTENDED
    please help
    Thanks
    Sam

    LOGMiner --> Using LogMiner to Analyze Redo Log Files
    AUDIT --> Configuring and Administering Auditing

  • How to find out list of variants in TVARV table

    hi!
    can anybody can guide me on the following issues? plz
    How to list all variants in TVARV table?
    How to find out any Z* programs that writes to TVARV table, using the variant name?
    How to find out the programs which are  reads the TVARV data into a program variant?
    Thanks & Regards,
    vijay

    Or some help might be useful:
    http://help.sap.com/saphelp_47x200/helpdata/en/c0/98037ae58611d194cc00a0c94260a5/frameset.htm
    Regards,
    Subramanian V.

  • How to find out what is the name of table/view is being maintained in  IMG?

    Gurus,
    Any general trick to find out what is the name of table/view is being maintained
    by a given IMG item while configuring?
    Thanks,

    Hi,
    Click F1  on the table/ view you will get the table name and then go to transaction give this table name and click on Find Maintainance Dialog their you will get the views related to that table.
    Regards,
    IFF

  • How to find out which field belongs to which table

    Dear all
             How to find out this "Field name:-  LFSNR" belongs to which table.
    regards
    M.Chandra mohan

    Hi
    You can go to SE84.
    ABAP Dictionary --> Fields --> Table fields
    Enter field name and execute. You will get list of table where this field is exist.
    hope it helps
    regards
    Srinivas

  • How to find out child tables

    Hi,
    My data base Table master_accouts contain some of child tables. I would like to
    Know How can i findout How many tables/what r those tables. Please guide me.
    warm regards,
    Venkat.

    Hi,
    My data base Table master_accouts contain some of child tables. Could you please give more information on what you want ?
    If you want to find the constraints then yo can use ALL_CONS_COLUMNS view to get the constraints.
    Thanks

  • How to find out which program fill a custom table ?

    Dear All,
    I am trying to find out which program fill custom table, I tried se11, which programs used this custom table via where used list but could not find. Is there any different way ?
    Regards

    Hi Sappcon,
    yes, it is as Brad said, but you should extend the approach regarding this tables content: If it is related to an existing business object (i.e. order, delivery or the like), you may have a look at user exits/Badis in that field.
    Also, the dynamic approach is possible. First use report RPR_ABAP_SOURCE_SCAN to find the name of the table in all programs in customer name space - it may be defined as a constant in program/function group/class.
    If the dynamic approach is used, the name of the table may be determined by reading another (custom) table or even in a programs text pool. You may find this by searching a pattern UPDATE() - or MODIFY/INSERT in customer programs.
    If the table has update date/time fields, check what jobs or online activities can be responsible.
    If, after all, you still do not know, then I'd say this is a consulting issue
    Regards,
    Clemens

  • How to find out last updatde timestamp for a table

    Hi All,
    I want to find out the last updated time stamp of a table. Is there some thing available with the sys tables. Is there something can be done with user_objects.
    Or, is there any need to write pl/sql code to get the last updated timestamp for a table.
    Please provide some inputs.
    regards,
    Naresh

    Hi Oleg,
    Select * from user_objects.I belieive it gives you the last_ddl_time not the time a update or delete was done.
    Not sure if we have this feature in any new release.
    I am working on Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    to the OP
    I will suggest if you planto audit then use the audit feature based on your DB version.
    Or to make it more simple have a column called modified_date and update this column whenever you update the record.
    Regards,
    Bhushan

  • How to find out the NULL columns in the table?

    Hi,
    Please provide the query to find the null columns in the table. Here, all rows in the table have same column as null. It won't change.
    Table
    c1 c2 c3 c4
    X C 10
    T D 20
    I wanna find out as C2 is the nullable column.
    Thanks in advance !!
    Regards,
    Vissu....

    Below code might be solution for finding NULL valued in columns in a table and if it is solution .kindly give me points for the same.
    declare
    cursor col_cur is
    select column_name
    from user_tab_cols -- all_tables can also be used in case the table is present in own schema
    where table_name = 'TABLE_NAME'; --provide the TABLE_NAME  
    stmt varchar2(1000):= '';
    v_count number;
    count_null number;
    begin
    execute immediate 'select count(*) from TABLE_NAME' into v_count; --provide the TABLE_NAME  
    for rec in col_cur loop
    execute immediate 'select count(*) from TABLE_NAME' where --provide the TABLE_NAME  
    '||rec.column_name||' IS NULL' into count_null;
    if count_null = v_count then
    stmt :=stmt|| rec.column_name ||chr(13);
    end if;
    end loop;
    dbms_output.put_line(stmt);
    end ;

  • How ti find out the list of all z tables.

    Hi Experts,
    I have to find out all the z tables of pp,pm and qm module so that i can know that the authorization group is filled or not.
    Pls its urgent.

    hi
    good
    you can use se11 to search any kind of table if you know the particular table name or else you can use z* as a search options for searching any kind of table.
    After getting the table name you can check the authorization check.
    thanks
    mrutyun^

  • How to find out if textFrame is really a table?

    Hey, I tried to find a solution for this on Google and in the forums, but I couldn't find it.
    I also tried different things, like "currentItem.hasOwnProperty('tables')", but of course this is true for every textFrame. I am searching for something like "object.isTable". Does anyone have a hint on how to do this?
    Thanks in advance!

    @Stamm – look for the length of the tables in the text frame or in its parent story:
    if (myTextFrame.tables.length > 0){doSomething()};
    or:
    if(myTextFrame.parentStory.tables.length > 0){doSomething()};
    Where do you start from? From a known text frame or just an object you are not sure about?
    Or from an arbitrary selection the user is doing?
    Also consider a check, if the text frame is overset and the required table is fully or partly (some rows) is in the overflow.
    Uwe

  • How to find out the selected line in the table control

    Hi Guys,
    i have a requirement like this. i have table control and the internal table for that table control as IT_CASE. this internal table i declared as CHECKBX, MATNR, QUANTITY. but when i am enter the values in the table control i am getting the values in MATNR and QUANTITY in the that internal table IT_CASE. but when iam selecting that that line iam not getting CHECKBOX as 'X' in that internal table IT_CASE. i declared the table control as CAS_CONTROL and in that i have given the "w/selcolum" property as IT_CASE-CHECKBOX. now i want to fill that CHECKBOX as 'X' inthat internal table IT_CASE whatever the lines we are selecting only for those lines i want to fill up as 'X' in that internal table.
    Can you please suggest any one reg this.
    Thanks in advance
    Rahul

    Hello body,
    You can give a name such as 'SEL' in  w/selcol and declare SEL as char1. Then follow the coading.
    in TOP.
    data: sel type c.
    PROCESS AFTER INPUT.
    user_command_0011.
    loop at <Your internal table>.
    module get_data.
    endloop.
    Inside Module get_data.
        if sy-ucomm = <Your Fcode>
        if sel = 'X'.
           <Your internal table>-<Field for checkbox> = 'X'.
          append <Your internal table>.
        endif.
      endif.
    I think your issue is resolved.
    Regards.
    S Mahanta.

  • How to find out the top ten Change log tables in BW

    I want to know the top ten change log tables in terms of size. Do we have a SAP standard table where we have the following fields : "changlog table name", "number of records" field or "data in size" field.
    Regards,
    Prashant M J

    Hi,
    Click on change log table in the ODS/DSO at the top you see the name as /bic* which is the name of the database table which could also be seen at SE11.
    If you wana see the requests in this change log use rstsodsrequest
    and if you wana see the size in terms of kb, mb DB02 or st04
    use the table name /bic* and click on tables and indexes option in history tab
    DB02 tells you the sizes of the tables present on database. Incase you are not able to your basis team would help you in that
    Thanks and regards
    Kiran

  • Find out who has given local administrator rights to standard domain user?

    In my Organization i have faced problems with domain administrator, it seem that all of a sudden a standard domain user is having Local administrator rights. Can anyone please help me how to find out who has given local administrator rights to that standard
    domain user account? 

    Hi,
    Based on your requirement, you need to enable the auditing in your Active Directory to identify the user/ group changes and WHO made the change etc.
    Checkout the below steps to enable auditing for AD User Changes,
    1. Open GPMC console, click Start --> Administrative Tools --> Group Policy Management.
    2. Right click the Default Domain Controllers Policy, and then click Edit.
    3. Navigate to Audit Policy node, “Computer Configuration/ Policies/ Windows Settings/ Security Settings/ Local Policies/ Audit Policy”.
    4. Now enable the Success auditing for - Audit Account Management and Audit Directory Service Access.
    5. Execute the command “GPUPDATE /FORCE” in the Domain Controller to force apply the GPO settings.
    For Windows Server 2008 R2 and later versions, additional configuration is required in  “Advanced Audit Policy Configuration” section in Default Domain Controller Policy.
    1. Go to the node DS Access (Computer Configuration/Policies/Windows Settings/Security Settings/Advanced Audit Policy Configuration/Audit Policies/DS Access.) 
        Enable Success auditing for the following settings
         - Audit Directory Service Changes
    2. Go to the node Account Management (Computer Configuration/Policies/Windows Settings/Security Settings/Advanced Audit Policy Configuration/Audit Policies/Account Management.) 
        Enable Success auditing for the following settings
        - Audit User Account Management
    After completing the audit settings, configure SACL in Active Directory Users and Computers console for enabling the geneartion of AD Change events in the eventlog as shown below,
    Checkout the below KB article on complete list on Event ID and Description for AD Changes,
    http://support.microsoft.com/kb/947226/en-us
    Regards,
    Gopi
    JiJi Technologies

  • How to find out the administrator name

    How to find out my administrator name to unlock the parental control .

    Look in the Apple Menu, in System Preferences, under the Users & Groups pane.
    It should list all your users, by name.

Maybe you are looking for

  • Previous iTunes Library - how to "force" a backup

    Hi there Running iTunes 11.4 on Windows 7 64 bit With the Previous iTunes Library folder I notice iTunes seems to make Library backups at "random". Is there a way I can force it to do a library backup whenever I want? Am asking as this morning opened

  • Copy/paste function not working in Firefox 22. Always good in previous versions

    Copy/paste function not working in Firefox 22. Always good in previous versions editions

  • Captivate 4 Aggregate Reporting

    We have created a training using the aggragate feature in captivate.  The training has multiple modules in the table of contents and contains individual quiz questions.  We have published to the Connect server.  The problem is that as soon as the use

  • Why do I get "communication error" when selecting Contacts in Backup Assist Plus?

    Have reset Backup Assistant Plus due to sync Errorcode 5 using Verizon response to others in this forum.  After running Backup Assist Plus again, I find that I cannot select Contacts for backup. I get a message that says "Error - There was a communic

  • Reset the videomerge option in PRE9

    When I dragged a movie to be edited, it prompted me to apply videomerge.  I selected the "do not ask me again" option and select "Yes".  I would like to reset this option so it either prompts me again, or does not automatically apply videomerge.  How