Difference between Truncate & Delete

Hi,
I've a table D with child tables A,B,C. I've truncated in the below order:
truncate table A;
truncate table B;
truncate table C;
truncate table D;
And got a foreign key dependency error, though I've truncated all the child tables;
When I issue delete from D, all the rows got deleted without any error.
How is Truncate different from Delete other than the AutoCommit?

Truncating a Table
TRUNCATE TABLE is a DDL statement, which is used to remove all rows from a
table and to release the storage space used by that table. When using the TRUNCATE TABLE statement,
you cannot rollback row removal.
Syntax
TRUNCATE TABLE table;
You must be the owner of the table or have DELETE TABLE system privileges to truncate a table.
Deleting a Table Record
The DELETE statement can also remove all rows from a table, but it does not release storage space. The
TRUNCATE command is faster. Removing rows with the TRUNCATE statement is faster than removing
them with the DELETE statement for the following reasons
1 ) The TRUNCATE statement is a data definition language (DDL) statement and generates no rollback
information.
2 ) Truncating a table does not fire the delete triggers of the table.
3 ) If the table is the parent of a referential integrity constraint, you cannot truncate the table. Disable the
constraint before issuing the TRUNCATE statement.

Similar Messages

  • Difference between Truncate and Deete .

    Hi All,
    Can any one pls tell me,
    what is the main difference between Truncate and Delete.
    Thanks in advance ,
    Sanjeev.

    Deletes perform normal DML,it take locks on rows, they generate redo and they require segments in the UNDO tablespace.
    If a mistake is made a rollback can be issued to restore the records prior to a commit.
    Truncates are DDL. A truncate moves the High Water Mark of the table back to zero so all extents bar the initial are de-allocated from the table

  • What is the difference between 'command delete' and using 'delete original and all versions'?

    My masters are not referenced and I usually have only one version.  What is the difference between using 'command delete' versus going to the top menu bar and using 'dele

    Good question  .
    When the Version is the only Version based on the Original of that Version, the two commands have the same effect.
    See this User Tip by master Aperturist Frank Caggiano.

  • Difference between Equipment deletion and deactivation

    Hi Experts,
    Greetings
    Can somebody clear me that what is is the difference deactivation of equipment and flag for deletion of an equipment
    Thanks in advance.
    R.A.Kiran

    Hi,
        If u mean to stop reversing it then .. i believe u should be able to do it via User status ..
    You should have a user status that gets activated with business transaction Mark for Deletion - You should make this as SET
    & for business transaction Remove deletion Flag - You should make this as Forbid .., the lowest and highest status nos should be same - means once this status is there the user status will not go to other status ..
    I was able to do it in my system -check it
    regards
    pushpa

  • What are the differences between delete and truncate statements.

    i need few differences between executing both the above statements.like what is the effect they are going to make on the data in the table and regarding the table
    spaces

    One of the main diffrence TRUNCATE is DDL while DELETE is DML thats why
    you neednt to commit/rollbacked after TRUNCATING table.
    If you have master/child table then TRUNCATING master table will not concerned
    with child table data ,it will concerned with FK enabled KEY truncate is DDL.
    While DML will concerned with detail table data when deleting master table data.
    SQL> DESC dept
    Name                                      Null?    Type
    DEPTNO                                    NOT NULL NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    SQL> DESC emp
    Name                                      Null?    Type
    EMPNO                                     NOT NULL NUMBER(4)
    ENAME                                              VARCHAR2(10)
    JOB                                                VARCHAR2(9)
    MGR                                                NUMBER(4)
    HIREDATE                                           DATE
    SAL                                                NUMBER(7,2)
    COMM                                               NUMBER(7,2)
    DEPTNO                                    NOT NULL NUMBER(2)
    SQL> TRUNCATE TABLE emp
      2  /
    Table truncated.
    SQL> TRUNCATE TABLE dept
      2  /
    TRUNCATE TABLE dept
    ERROR at line 1:
    ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    SQL> Unless you dont disable/drop FK key from child table you cant TUNCATE master
    table data.
    Khurram

  • In mail, what is difference between deleted and discarded mail

    In settings, mail, what is difference between deleted mail and discarded mail? My google account on iPad does not remove mail that I have deleted from account using other devices. My other devices and google accounts don't have this issue. I've checked settings for account and can not isolate the cause. I'm considering deleting account from iPad and then adding it back in to see if that removes the 1000+ emails that have accumulated. I don't usually use iPad for email which is why they are mostly unread on iPad.

    this might help to understand
    Collection Classes
    Often we have to deal with a set or group of objects, or values. Collection Classes are important structures that have a number of methods that allow objects to be added, retrieved, or removed from such collections.
    Objects can be grouped in a collection like sets, lists, stacks, or queues.
    A set is an unordered collection of elements, from which any item may be removed.
    A list is an ordered collection of elements, from which any item may be removed.
    A stack is a restrictive form of list that obeys a last-in-first-out (LIFO) rule.
    e.g.     a stack of plates stored after being washed, then used again.
    A queue is also a restrictive form of list that obeys a first-in-first-out (FIFO) rule.
    e.g.     a queue at a bus-stop, where the first bus to join the queue is the first one to leave.
    An important Java Collection class is the Vector class:
         java.util.Vector
    This vector class is a simple list of objects, which can be referenced by an index starting from 0 (similar to arrays). The components of a vector must be objects.
    i.e. Vector: object0 object1 object2�lastObject .. spare
    capacity                         ( size - 1)
    So, a vector can grow as more objects are added. The size of a vector is how many objects are in the vector. The capacity is how many objects can be stored in the vector before it needs to expand again. When it needs to expand it normally doubles its capacity. The default capacity is 10.
    e.g.     Vector v1;          // declare v1 as a Vector object
         v1 = new Vector();     // create a Vector instance

  • What's the difference between deleted messages and trash?

    what's the difference between deleted messages and trash?

    A Time Capsule is hardware. It's basically an Apple AirPort Extreme wireless router with a built-in hard drive. For more info on this product:
    http://www.apple.com/timecapsule/
    Time Machine is a software application that allows your Mac to backup its data automatically to the hard drive on the Time Capsule. For more info on this software, which is included with the Leopard, Snow Leopard and Lion operating systems:
    http://www.apple.com/findouthow/mac/#timemachinebasics

  • EREC: Differences between Delete Registration & Delete External Candidate

    Hello Experts,
    I am new to E-Recruitment. Can you please suggest me what are the exact differences between Delete Registration & Delete External Candidate as the first one locks his profile & the second one deletes his profile except that I don't see much difference between them. Please explain in which cases each of the tabs will be used & the relevance of them.
    Thanks in Advance..
    Vamsi

    The main difference relates to how the data is handled in backend and whether all E-Recruiting objects are deleted immediately or mdeleted at a later time through the RCF_PERIODICAL_SERVICES process whereas for example the report RCF_DELETE_EXT_CAND checks the candidacies assigned to that candidate and for each of these objects which retention date is set to the requisition mapped.
    The periodical serivce DELETE_DEREGISTERED_CANDIDATES can only delete deregistered candidates with no assignments. The deletion of assignments such as applications should be done within the deregistration workflow. There are some steps and methods available to withdraw and delete such relationships and unless there are open assignments the report would ignore the candidate.
    One more thing to be aware of is that normally there is a delay maintained when a candidate is deregistered. So please check your settings in T77RCF_PS_RULES if the candidates you see have been deregistered within this time.In standard the delay is 180 days in which candidates are then deregistered. So if you deregister today, the system will deregister and delete all the candidate data only 180 days after today.
    Hope it would help you further
    Sally

  • What is difference of truncate/insert and delete/insert ?

    hi all:
    what is difference of truncate/insert and delete/insert ?

    Hi,
    Truncate will truncate the table, which means there is a DDL operation to empty the table. DDL operations cannot be rolled back, but truncate is much faster than delete (because of that reason). If you do not require recovery of the deleted records in case of a failure, then truncate/insert is more optimal than delete/insert. Notice that for truncate to work, you cannot have enabled foreign keys pointing to the table. Truncate will never perform cascaded deletes.
    Hope this explains.
    Mark.

  • What is the difference between methods of deleting data from cube

    Hi,
    Is there any differences, pros and cons for deleting data from cube by:
    1) deleting the specific request loaded into the cube
    2) using selective deletion with specific characteristic values
    Assumption for the above is both the options will delete the same data set.
    Thanks and regards.

    Hi BW Beginner,
    Yes, of course, there are differences.
    Selective Deletion:
    PROS: You can use to delete data that satisfies a certain criteria (e.g. some characteristic values).
    CONS: I think this locks the whole cube during deletion
    Deletion by request id:
    PROS: You can easily delete all data that belongs to a certain request id (i.e. you can easily delete a bad load).
    CONS: If you have already compressed the cube, you can not use deletion by request id to delete a certain request.
    Hope this helps.

  • Blends: Difference between open and closed paths modifying spine

    Okay, just had a discovery today about the blend tool.
    The difference between closed paths and open paths is critical when you want to modify a blend spine, such as make it curve. Between open paths, there is no spine shown when a blend is created. Ever notice this? Between closed paths, there is a spine, which can be modified, such as making it curved. Now, the trick is how to modify a spine with open paths when there is no spine shown. Found out today that starting with a closed path, segments can be deleted to make the path open, then the spine can be modified and the open path state maintained!
    This is a huge bug in Illustrator and makes no sense to me. Wanting Adobe to fix this in the next major release. Hope this helps anyone struggling with this issue.

    One thing you should be aware of concerning open ended splines:
    It makes an enormous difference as to how the blend behaves whether the endpoints have handles or not.
    Give them handles and you will find that you can alter the distribution of the blend objects just by adjusting the handles or by dragging on the spline itself.
    Give it a try.

  • What is difference between adjusting columns these two ways?

    Hi everyone,
    In my last post I learned that I could create a new Master Page that is designed as a 1-column format and apply it to the body pages I want to have as 1-column. (I have a doc that has 2-column formatted L and R master pages; only 1 page at the very end, the Study Guide, needs to be 1-column formatted).
    I recently learned from the Adobe lesson book that if I am in the body page that I want to change from a 2-col to a 1-column format, I can go Graphics>Object Properties and this brings up the Customize Text Frame window where I can change the number of columns to 1 and click set. I found this a lot easier than creating a new Master Page.
    What is the difference between applying a one-column design to one page using each of these methods, applying a 1-column master page versus just changing the number of columns as described above? Is one wrong or better than the other?
    Thank you for your help!!

    There are 3 basic* ways of obtaining a custom layout for specific pages:
    hack the local column layout
    apply a new master Page as a local override:
    Format > Page Layout > Master Page Usage > Use Master Page
    map the new MP in semi-automatically:
    Format > Page Layout > Apply Master Pages (AMP)
    1 & 2 are not stable. Unless it's a disconnected flow, adding or deleting text prior to that page can cause your special-needs text to re-flow onto a page with normal Left/Right layout (and unexpected text flowing onto your special layout).
    1 is also at risk from an update to the Left/Right MPs themselves.
    3 requires that some paragraph on the special-needs page have a unique format name (say, "Heading2_Single"). After you perform your first AMP, an UnstructMasterPageMaps table is created on Reference Page MasterPageMaps. Add the special para name, and the special MP name to it. Thereafter, AMP will make sure that text gets the page it needs.
    You can also perform an AMP during Update Book.
    It is not reliable in FM 7.x. I don't know about later versions.
    I always use technique #3, and perform a separate AMP as part of the pre-print workflow.
    * You can also fake the layout in some cases, on the normal page layout, by putting the special needs flow in a table or text frame within an anchored Frame. Anchor to an Across-All-Columns format as needed. It wouldn't be Framemaker if there weren't at least 5 ways of getting the same result .

  • What is difference between Iterator and Collection Wrapper?

    Hi all,
                  I dont understand the actual difference between Iterator and Collection Wrapper. I observed both are used for the same purpose. Could any one please let me know when to use Collection Wrapper and when to use Iterator??
    Thanks,
    Chinnu.

    L_Kiryl is right.
    Collections support global iteration (through collection->get_next( )) and local iteration (through iterator->get_next( )).
    Each collection has a focus object. Initially, the first object has the focus.
    Any global iteration moves the focus, which is published by the event FOCUS_CHANGED of the collection.
    If you want to iterate on the collection without moving the focus (and without triggering timeconsuming follow-up processes) you can use local iteration. To do so, request an iterator object from the collection and use this to iterate.
    And one more advantage of using iterator: it takes care of deleted entities. If you use global iteration then when you reach deleted entity it will be an exception. But there is no exception with iterator in the same situation.

  • Re: what is difference between sap locking and database locking

    hi,
        what is difference between sap locking and database locking. Iam locked the table mara by using lock objects.
    But iam unable to unlock the mara table. I give u the coding. Please check it.
    REPORT zlock .
    CALL FUNCTION 'ENQUEUE_EZTEST3'
    EXPORTING
       MODE_MARA            = 'S'
       MANDT                = SY-MANDT
       MATNR                = 'SOU-1'.
    call transaction 'MM02'.
    CALL FUNCTION 'DEQUEUE_EZTEST3'
         EXPORTING
              mode_mara = 'E'
              mandt     = sy-mandt
              matnr     = 'SOU-1'.
    IF sy-subrc = 0.
      WRITE: 'IT IS unlocked'.
    ENDIF.

    Hi Paluri
    Here is the difference between SAP locks and Database locks, i will try to find the solution to your code.
    Regards
    Ashish
    Database Locks: The database system automatically sets database locks when it receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on the database entries affected by these statements. You can only set a lock for an existing database entry, since the lock mechanism uses a lock flag in the entry. These flags are automatically deleted in each database commit. This means that database locks can never be set for longer than a single database LUW; in other words, a single dialog step in an R/3 application program.
    Physical locks in the database system are therefore insufficient for the requirements of an R/3 transaction. Locks in the R/3 System must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and even different application servers. Consequently, each lock must apply on all servers in that R/3 System.
    SAP Locks:
    To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the R/3 System also contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks.
    The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships.
    Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary.

  • What is the difference between PUSH and FETCH

    I am a little confused. I use my iphone for both my personal POP email accounts and my business exchange account. I am trying to save as much battery as I can so I turned off push and set everything to manual...but now when I try and get may mail....it either says "connecting" or "checking for new mail" at the bottom of the screen and nothing happens from there.
    What is the best way to setup this situation for the most battery life? I don't need it to automatically download emails just when I open the email accout would be nice.
    I also noticed that when I delete an email from my iphone on my exchange account, it also deletes is on my desktop at work...I need to turn this off...is it possible?

    Hi maxum25,
    The difference between push and fetch is that:
    When using push, the server sends a signal to the iphone and lets it know that an email is coming its direction. Kind of like receiving a call. The iphone does not need to do anything except receive the email.
    When using fetch, the iphone has to wake up every so often and send a request to the server to see if there is any new email waiting for it on the server to download. This takes more time because the iphone sends a request, the server says yes there is some, the iphone says ok give me the new email.
    Now the exchange email uses active sync to keep all changes on the exchange server and mobile device in sync. This is automatic and is the nature of exchange and active sync. In order to keep this from happening you would need to talk to your IT dept. and see if they have an imap or pop alternative. Even using imap reflects the changes back to the server.
    Hope this helps.

Maybe you are looking for

  • Want to get placed images Dimension and Creation Date in Catalog

    Below is the script which is free with CS4. Is there anybody who can modify this script in a way which provide the creation date and dimension of the images in image catalog. //ImageCatalog.jsx //An InDesign C4 JavaScript @@@BUILDINFO@@@ "ImageCatalo

  • Stuttered performance

    Hi. I just got a new Mac Pro 2.66 with a gig of ram, and I've noticed that a lot of applications seem to stutter (just take their time, or the mouse pointer turns into the revolving rainbow ball for a while) a lot. Offending applications include Fina

  • Delivery note during GR

    Dear experts, I want system to restrict user from making double GR against same delivery note number. Plz suggest me the solution. Can you tel me whether any user exit is available for the same & how to fulfill this requirement. Awaiting for ur valua

  • Dust removal

    This seems pretty basic, but I couldn't find it in either this forum or the Aperture 3 user's manual: I've been using Adobe Photoshop Elements and iPhoto, but I recently upgraded from iPhoto to Aperture, and Aperture seems to do pretty much everythin

  • HT4946 Help with backing up iphone!!

    Where do all my contacts get backed up to? Everything appears encrypted though I opted not to encrypt. I'm so lost.