Exam 1z0-071 All QuestionsBrowse all questions from this exam
Question 115

Which statement is true about TRUNCATE and DELETE?

    Correct Answer: B

    TRUNCATE cannot be performed on a table if it violates foreign key constraints, unless those constraints are disabled. This restriction ensures that referential integrity is maintained in the database. While there are certain exceptions, such as self-referential constraints, the general rule holds that TRUNCATE cannot be used when it would violate active foreign key constraints.

Discussion
aamm74200Option: C

C. A and D: False --> Truncate is better and has better performance than delete and Drop except for very small tables. B False --> You can truncate a table with a FK on Cascade. You can disable FK and then Truncate (except if FK is self-refential).

Viviana3184Option: C

i think C is correct if the referential integrity constraint has the ON DELETE CASCADE option

lucemqyOption: C

C is correct since you can delete using cascade option B is incorrect since it says never but you can by disable the constraint

Orxan_HOption: B

B is correct

ShrimathiOption: C

C is correct, We can trucate table contains referential integrity, one by drop the constraint/ while adding constraint we can include on delete cascade . Truncate table colors cascade; this statement will run successfully. Reference https://www.examtopics.com/discussions/oracle/view/15064-exam-1z0-071-topic-1-question-268-discussion/

jfc1Option: B

D is wrong . B is correct https://docs.oracle.com/database/121/SQLRF/statements_10007.htm#SQLRF01707

billysunday1Option: B

Answer is B ORA-02266: unique/primary keys in table referenced by enabled foreign keys

hmatinnnOption: B

So answer should be B

hmatinnnOption: B

The answer is B Here is explanation : In this option it does not mean you can never truncate a table it says if foreign key activated and would be violated you can NEVER. The keyword is IF <<<<

yanoolthecoolOption: C

C CAN work if we have CASCADE, B is wrong cuz it says NEVER, the documentation states: 'You cannot truncate the parent table of an enabled foreign key constraint. You must disable the constraint before truncating the table. An exception is that you can truncate the table if the integrity constraint is self-referential.'

yanoolthecool

there's also this: CASCADE If you specify CASCADE, then Oracle Database truncates all child tables that reference table with an enabled ON DELETE CASCADE referential constraint. This is a recursive operation that will truncate all child tables, grandchild tables, and so on, using the specified options.

McromeoOption: B

B is correct. Truncate is faster than delete

jm9999Option: B

Very confusing. It seems truncate is always faster than delete. And for B and C, B is false if you use cascade in the command and constraint was created with on delete cascade. Similarly with C, if constraint was created with on delete cascade then you can delete those rows.

jm9999

The problem with B is that there is an exception for self referential constraint and B uses the word 'never'. I think it's C because of the 'on delete cascade option'.

RonerosOption: B

You cannot truncate the parent table of an enabled foreign key constraint. You must disable the constraint before truncating the table. https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/TRUNCATE-TABLE.html

TofOra

From the link: You cannot truncate the parent table of an enabled foreign key constraint. You must disable the constraint before truncating the table. An exception is that you can truncate the table if the integrity constraint is self-referential.

ESZ

This needs to be updated!

zouveOption: B

Option B is true. When using the TRUNCATE statement, if there are foreign key constraints referencing the table to be truncated, you will not be able to truncate the table. Truncating a table removes all the data in the table, and if there are dependent foreign key constraints, truncating the table would violate those constraints. In such cases, you would need to either disable or drop the foreign key constraints before truncating the table.

TofOra

It says "NEVER", but is possible for self referenced tables.

Cecilia_SosoOption: B

B -You cannot truncate the parent table of an enabled foreign key constraint. You must disable the constraint before truncating the table. An exception is that you can truncate the table if the integrity constraint is self-referential.

dexdinh91Option: B

I think B is correct (but not sure 100%)