How to check that my table is parent table or child table before trucating

Hi:
say i wanted to trucate a table .the table might be a parent table or might be a child table.if its a child table then there wouldnt be any problems in truncating.
if its a parent table the i believe i would have to diable all the foreign key constraints from the child table referring to the parent table ..my question is
1. i have a table say ABC. before truncating how do i find out if table ABC is a parent table or not?
2.lets assume i tried to truncate the table ABC and i got the error saying that disable the foreign keys on the child table referring to the parent table ABC.
in my schema there are say 50 tables.out of which there might be 10 odd child tables referring to my parent table ABC.
so my question here would be how do i specifically find out these 10child tables referring to the Parent table ABC so that i can disable the foreign keys on the child tables.
Thanks 4 ur time in reading this and hopefully i think u wld give me a solution!!

Hi,
Try this SQL below:
select r.owner, r.table_name
from user_constraints r, user_constraints o
where r.r_owner = o.owner and r.r_constraint_name = o.constraint_name
and o.constraint_type in ('P','U') and r.constraint_type = 'R'
and o.table_name = 'ABC';Cheers

Similar Messages

  • How to check  that same Oracle software versions(including patch versions)

    How to check that same Oracle software versions(including patch versions) is installed on two hosts(machines) ?
    We are using following process:
    On Host A :
    1) Get the Oracle version using SQLPlus -v
    From this output, extract the version number.
    2)Find the patches installed using opatch lsinventory -detail
    From the output , Extract the Patch numbers and Bugs fixed.
    3) Store the version , patch and bugs information in a common file.
    On Host B :
    Repeat the steps 1 and 2 and compare with the values from Host A.
    Please let us know if there is any other method to do this.
    Thanks.

    This is wrong: for Oracle Database version 10.2.0.4 *4* identifies the patch set and does not give information about interim patchs.
    It is correct to use opatch lsinventory to get interim patchs.
    Edited by: P. Forstmann on Jul 21, 2009 12:38 PM

  • Sql server partition parent table and reference not partition child table

     
    Hi,
    I have two tables in SQL Server 2008 R2, Parent and Child Table.  
    Parent has date time, and it is partitioned monthly,  there is a Child table which just refer the Parent table using Foreign key relation.   
    is there any problem the non-partitioned child table referring to a partitioned parent table?
    Thanks,
    Areef

    The tables will need to be offline for the operation. "Offline" here, means that you wrap the entire operation in a transaction. Ideally, this transaction would:
    1) Drop the foreign key.
    2) Use ALTER TABLE SWITCH to drop the old data.
    3) Use ALTER PARTITION FUNCTION to drop the old empty partition.
    4) Use ALTER PARTITION FUNCTION to add a new empty partition.
    5) Reapply the foreign keys WITH CHECK.
    All but the last operation are metadata-only operation (provided that you do them right). To perform the last operation, SQL Server must scan the child tbale and verify that all keys are present in the parent table. This can take some time for larger tables.
    During the transaction, SQL Server holds Sch-M locks on the table, which means that are entirely inaccessible, even for queries running with NOLOCK.
    You avoid this the scan by applying the fkey constraint WITH NOCHECK, but this can have impact on query plans, as SQL Server will not consider the constraint as trusted.
    An alternative which should not be entirely dismissed is to use partitioned
    views instead. With partitioned views, the foreign keys are not an issue, because each partition is a pair of tables, with its own local fkey.
    As for the second question: it appears to be completely pointless to partition the parent, but not the child table. Or does the child table only have rows for a smaller set of the rows in the parent?
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to check that Delta is not captured?

    Dear Experts,
    I am using 2LIS_02_ITM datasource.
    PO is created using a program.
    The next step in the program, it can change a field in the PO depending on logic, using a abap command 'update'.
    Sometimes, this change is not captured in the delta queue, it seems.
    why i say this is the PO shows the field value but BI delta load does not.
    It is using Queued Delta now.
    Initially, the program uses a command 'update' to update the field in PO.
    Now, we decided to use ME22N program to ensure delta will be created.
    The problem is happening to some records and not all delta records.
    Its very difficult to tell what is the cause.
    What is the standard method to check that Application table data is not captured in Delta Queue by the extractor?
    Or
    If PO can show the field value, is there a possibility that Delta may not capture this field change?
    regards
    Pascal

    Well just throwing few possibilities:
    1 - Basically PO creation, change in values/quantities etc are Business transactions and they generate evens known as BTEs.
    Now we have to explicitly inform SAP ECC that which applications can use BTEs and we do this by tcode BF11.
    Check if the software component creating and changing POs is properly linked to BTEs and if BW is set as active in BF11 tcode.
    2 - If point 1 is checked and nothing is found to be incorrect, please check if Industry sector is correctly chosen (SBIW). Industry sector generates a set of Transaction keys (BWVORG) without which the values are not updated in BW.
    Also rightly pointed by Tbollo, you need to ensure that there's a pattern in the missing docs to identify the rootcause.
    Debanshu

  • 5400 / 7200 RPM. How To Check That?

    hi guys.
    the box with a brand new external usb drive i am planning to purchase from my local computer store doesn't say whether it's as fast as 5400 or 7200 rpm.
    how do i normally check that parameter through my computer? i tried checking that on my current usb drive with system profiler, but can't see such a section anywhere!

    Aram Rian wrote:
    thanks for the reply.
    hmm, well i still need to somehow make sure the rotation speed of the usb hard drive i am going to purchase is 7200 rpm
    I don't think it really matters from a practical point of view. The maximum sustained transfer speeds you can get out of Hi-Speed USB (USB2) is about 30-35 MB/sec. This is well under the speeds that most current 5400 RPM notebook drives are capable of. For example, a Hitachi Travelstar 5K320 drive is capable of up to 729 Mbit/sec, which is higher than 90 MB/sec.

  • How to check that concrete object is on the scene?

    Hi
    I wonder how can i check that concrete object is on the scene for example:
    var sprite1:Sprite = new SPrite();
    stage.addChild(sprite1);
    if(?????)
        //do something with sprite1
    else
         //add sprite1 to display list and do something with it
    Is there any property or method to check this?

    If you mean that the object exists, you can try...
    if(sprite1)
        trace("it exists");
    else
         trace("it's not here");
    otherwise, if you mean you want to know if it's on the display list, you need to go thru the display list to see if it's in there...
    var child:DisplayObject;
    var spriteFound:Boolean = false;
    for (var i:uint=0; i < stage.numChildren; i++)
    child = stage.getChildAt(i);
    if(child == sprite1){
       spriteFound = true;
    if(spriteFound){
    trace("it's on display list");
    } else {
    trace("it's not here");

  • How to check that whose access my system

    i am use computer and i want to check how many request comes my computer and which files or folder shered at that time ????

    I like to use netbeans which one should i need to download?You'd think you would go to the Netbeans website and find out, but I'm silly like that. Either a recent JDK 6 or the latest JDK 7 will do just fine. I would install Java anywhere except in program files. I install all my Java stuff in a directory called "java" myself, so I have C:\java\jdk6, c:\java\eclipse37, c:\java\tomcat7, etc. I never have to search for my stuff that way.
    (of course being a proper computer savvy user I partioned my harddrive to reserve the C drive specifically for the OS only, so it is in fact e:\java).
    2)How to find apache tomcat server is installed in by PC or not how to test that ?Use the search function of your OS of course. Its not even a Java related question.

  • Time Machine: How to check that it's working?

    hey guys, i just ran Time Machine for the first time and it looks like everything worked ok. it completed the backup and will run another backup in 20 minutes. i was just wondering how i can check that my files are actually being backed up in case i had to restore the files. how would i go about restoring the files by the way? i can't see an option to do this.         
    thanks a lot

    ThunderCon wrote:
    ok i had a look at that, but couldn't find an answer to this:
    i just noticed that my time machine drive is 4gb smaller than my mac internal HDD. is there any reason for this?
    Yes, as softwater and others have said, Time Machine does skip some things, such as system work files, most caches and logs, etc.  The size of all that varies widely from time to time, but is usually several GBs.
    See the tan box in Time Machine - Frequently Asked Question #11 for the gory details.
    But the size of the data on your TM drive will grow as more backups are performed, copying only the items that are new or changed, eventually filling all the available space.  Then it will begin deleting the oldest backup(s) when it needs room for new ones.
    but doesn't Time Machine create a bootable copy of the hard drive anyway?
    No, TM backups aren't directly bootable.  If your internal HD dies, you can restore your backups to a replaced internal HD, or another external HD.  The restored system is bootable.
    if the hard drive died, wouldn't Time Machine be able to restore everything?
    Yes.  The things it doesn't back up are re-created as needed anyway.  See FAQ #14 for details on doing a full restore.

  • How to check if data is stored in UPPER case in table columns?

    What is the SQL statement/command to check that the data in a table column is stored as UPPER case??

    Try the following, where ename is the column you want to check.
    select *
    from emp
    where ename != UPPER(ename)

  • How to check that a pdf is in ISO 32000-1:2008(PDF 1.7) standard?

    Hi
    How one can know that a pdf file is in  ISO 32000-1:2008(PDF 1.7) standard format?
    Breif Introdution abt ISO 32000-1:2008(PDF 1.7)
    ISO is named as "International Organization Standardization" who look after the standardization of diffrent format gobally. Now that had mention ISO 32000-1:2008 standard for PDF. So how we ensure that a pdf is of this standard.
    Do acrobat had any option to look the ISO standard of a pdf file or else way to view it.
    Thanks
    Andy

    ISO 32000-1 is nothing to do with PDF/A - it is the core standard for the PDF/1.7 document format. PDF/A is covered by ISO 19005-1.
    Preflight can run a number of checks but there is no easy way to verify compliance with PDF/1.7 as a whole. You can try the "Report PDF Syntax Issues" profile in Preflight but that does not guarantee to detect non-compliance, only the most common things which will break the document.
    Creating your PDF files using a standards-compliant application such as Adobe Acrobat is by far the best option - I  never recommend refrying a PDF unless there is a specific necessity to do so and the file is only destined for hardcopy print, as it will break pretty much everything (accessibility tags, scripts, forms, links, media, layers, color spaces, certificates, etc.).
    Because it's not easy to verify, and Acrobat always produces standards-compliant files, many commercial printers and publishers insist on "Adobe PDFs" rather than generic ones, and will reject files that have been created with third-party software.

  • How to check that iPhone 4 is factory unlock or not

    how to check an iPhone is factory unlock or not

    There is no way to check. This question gets asked all the time, and the simple fact is if you purchased your phone from an official source that sells officially unlocked iPhones, your phone is officially unlocked. If you didn't purchase from an official source, there is a good chance it was hacked.

  • How to check that iphone 4 is factory unlocked

    I have bought my first iphone 4 yesterday...its has iOS 4.3.5 (8LI)....i m using local sim and vedor said that it is factory unlocked but i don't have any idea that how to check this....i want to upgrade my iOS to iOS 5....PLZ guide me....
    thanks

    There is no way to check. This question gets asked all the time, and the simple fact is if you purchased your phone from an official source that sells officially unlocked iPhones, your phone is officially unlocked. If you didn't purchase from an official source, there is a good chance it was hacked.

  • How to check that my portal service is running

    Hi,
    Do you know some admin application in portal which show all services that are running
    I created a simple portal service and when I try to get it with this code:
       public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
        try {
          response.write("!!!BEGIN OF TEST<br/>");
          String srvID = IPCDProvider.KEY;
          IPCDProvider service = (IPCDProvider)
              PortalRuntime.getRuntimeResources().getService(srvID);
          response.write("<p>Name = " + service.getKey()); 
        } catch (Exception e) {
          // TODO: handle exception
          response.write("END WITH ERROR!!!<br/><br/>");
          response.write("ERROR:::" + e);
    I receive error : ERROR:::com.sapportals.portal.prt.service.ServiceException: Service not found: pcd.PCDProvider
    I want to check that my service is deployed and running

    Yes I saw (under System Admin -> Support -> Portal Runtime -> Application Console) that my service is started
    But I receive error when I try getService method
          String srvID = "tc.lm.ctc.cpa.pcd_sda";
          IPCDProvider service = (IPCDProvider)
              PortalRuntime.getRuntimeResources().getService(srvID);
    This is portalapp.xml of my testing application
    <?xml version="1.0" encoding="utf-8"?>
    <application alias="ShowPCDConfigData">
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.pcd.glservice,tc.lm.ctc.cpa.pcd_sda"/>
      </application-config>
      <components>
        <component name="Test">
          <component-config>
            <property name="ClassName" value="com.sap.tc.lm.ctc.cpa.pcd.test.Test"/>
          </component-config>
          <component-profile/>
        </component>
      </components>
      <services/>
    </application>
    This is a portalapp.xml of my portal application  that expose servise (that I am tring to get)
    <?xml version="1.0" encoding="utf-8"?>
    <application alias="PCDProviderService">
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.pcd.glservice"/>
      </application-config>
      <components/>
      <services>
        <service name="PCDProvider">
          <service-config>
            <property name="className" value="com.sap.lm.ctc.cpa.pcd.service.PCDProvider"/>
            <property name="startup" value="true"/>
          </service-config>
        </service>
      </services>
    </application>
    Could you help me, please

  • Delete the parent records and child table records at a time

    hi all;
    I am facing the pbm like to delete the all records in child table and corresponding records in parent table at a time. so I want to delete the all the records in child table and corresponding parent records in parent table by using single SQL query. plz help me
    Thanks in advance

    You want to use one single SQL statement to delete the child records in a table and the corresponding master records in the master table??
    That's not quite possible with a single SQL, of course unless you are talking about Oracle Forms, where you have a relation and set the delete behavior to Cascading, like said in the above posts.
    Tony

  • Parent table on one database and child table on the other database same svr

    Hi all,
    1. Create table A with primary key on one database
    2. Create table B with foreign key referencing the primary key of table A on different database but same server...
    How to do that, is that using database link..but how?
    Please, help
    Regards,
    - Sri

    You cannot use database link to define foreign key: see database link restrictions.

Maybe you are looking for