Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Conditional multitable inserts

anishjpDec 31 2015 — edited Jan 1 2016

Hi guys

Below is a sample question from the topic "Conditional multitable inserts". I cannot understand the explanation given by the author to support his answer.

insert

     when (part_no < 500) then

      into store_inventory (num, product)

      values (spare_id, part_name)

     into port_inventory (num, product)

      values (spare_id, part_name)

     when (part_no >= 500) then

      into ship_inventory (num, product)

      values (spare_id, part_name)

     select spare_id, part_no, part_name

     from spares;

Which of the following statements are true for this SQL statement.

A) If the first WHEN condition in line 2 is true, the INTO clause in line 3 through line 4 will be executed, after which processing will skip to the next row returned by the subquery.

B) If the first WHEN condition in line 2 is true, the WHEN condition in line 7 will not be evaluated.

C) No matter which WHEN condition is true, the INTO clause in line 5 will be executed regardless.

D) Regardless of whether the first WHEN condition is true or not, the second WHEN condition will be evaluated.

The author says the answer is D. He says "both WHEN conditions will be evaluated because the conditional INSERT is an INSERT ALL statement". The authors explanation to support the answer is not making any sense to me! Can someone explain to me?

This post has been answered by GregV on Dec 31 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 29 2016
Added on Dec 31 2015
4 comments
1,126 views