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!

PL/SQL delete set of values

PetrMNov 19 2018 — edited Nov 20 2018

Hi, could you help?

I have never written procedures in PL/SQL and I do not know how to do it:

I need to write a PL/SQL procedure that will be called for a set of values (for example X) and will end depending on the final condition.

Something like that:

An input set of values:  X = (1,2,3,4,5)

CREATE PROCEDURE DELETE_VALUES.

BEGIN

Steps in procedure:

1. COUNT (*) FROM Table_1 WHERE index IN X  - (A)

2. COUNT (*) FROM Table_2 WHERE index IN X  - (B)

3. DELETE from Table_1 WHERE index IN X  - (C)

4. DELETE from Table_2 WHERE index IN X  - (D)

5. IF  (A) = (C) AND (B) = (D) COMMIT    (if not then ROLLBACK)

Could u please help me?

Thank you in advance

Comments
Post Details
Added on Nov 19 2018
12 comments
615 views