Control Structures  «Prev  Next»

PL/SQL Block Goto Statement - Exercise

Create a PL/SQL block with labels and a GOTO statement


Objective:Identify the use of labels and the GOTO statement.

Exercise scoring

This exercise is worth a total of 25 points. You will receive up to 10 points for submitting the correct code to build the PL/SQL block using labels and the GOTO statement. You will receive up to 10 points for submitting the code without using labels and the GOTO statement. You will receive up to 5 points for explaining which you prefer and why.

Background/overview

e-pet.com has hired you for your PL/SQL skills. Before the store can sell pets online, it requires your immediate assistance to build a PL/SQL block that will look for the last pet product sold and list the first name of the customer who purchased it.

Instructions

  1. Use the SALES_DATE field from the CUSTOMER_SALE table to identify the latest pet product sold.
  2. Use the FIRSTNAME field from the CUSTOMER table to get the name of the customer.
  3. Build this block using labels and the GOTO statement.
  4. Build this block without the use of labels and the GOTO statement.
  5. Explain what style of code you prefer and why.

Download files

Download the PETSTORE schema files from the following link.

Submitting your exercise

Once you have written your PL/SQL block, place it in the text area below and click the Submit button to submit the exercise.