A legacy PL/SQL codebase may still contain labels and GOTO statements,
especially in older procedural logic. In modern Oracle development, structured control
flow is usually preferred because it is easier to read, test, and maintain.
In this exercise, imagine that you are reviewing code for a pet store application.
Your task is to write a PL/SQL block that locates the most recent sale in the
CUSTOMER_SALE table and returns the FIRSTNAME of the related customer
from the CUSTOMER table.
You will first solve the problem using labels and GOTO, then rewrite the logic
using structured PL/SQL so you can compare both approaches.
In current Oracle PL/SQL practice, GOTO is valid syntax but is generally reserved
for exceptional cases. Prefer structured constructs such as
IF, CASE, LOOP, WHILE, and exception handling
when they express the logic more clearly.
Download the PETSTORE schema files and review the table definitions before writing your solution.