Homework Assignment - PL/SQL - IF and loop:

General Instructions: In all of these questions, I want a printout of the PL/SQL and a printout of the results of executing the PL/SQL. Where tables are involved, I want a printout of the table and if the table has been altered, I want a printout of the table before and after. At least some of these assignments must alter a table.

First: Write the PL/SQL code to take in a field, use it in a query and show the results using one of the tables that you have.

Second: Write PL/SQL code to use a simple IF...ELSE.

Third: Write PL/SQL code to use a nested IF..ELSE. I want nesting on the IF and nesting on the ELSE.

Fourth: Write PL/SQL that uses the IF...ELSIF.

Do not use user input in programs with LOOPS.

Fifth: Write PL/SQL that uses the LOOP...END LOOP with an EXIT WHEN embedded in the code.

Sixth: Write PL/SQL that uses the WHILE...LOOP.

Seventh: Write PL/SQL that uses the FOR LOOP.


Extra Credit:Create a new table to hold the results prior to executing the PL/SQL. Using PL/SQL write a routine to extract a record from a table, manipulate the data and place the record in the new table you created.