Questions
Questions
8. Rewrite the following IF statement to work as efficiently as possible under all conditions,
given the following information: the calc_totals numeric function takes three minutes to
return its value, while the overdue_balance Boolean function returns TRUE/FALSE in
less than a second.
IF calc_totals (1994, company_id_in => 1005) AND
NOT overdue_balance (company_id_in => 1005)
THEN
display_sales_figures (1005);
ELSE
contact_vendor;
END IF;
END IF;
END IF;
12. Select the type of loop (FOR, WHILE, simple) appropriate to meet each of the
following requirements:
a) Set the status of each company whose company IDs are stored in a PL/SQL table to
closed.
b) For each of twenty years in the loan-processing cycle, calculate the outstanding loan
balance for the specified customer. If the customer is a preferred vendor, stop the
calculations after twelve years.
c) Display the name and address of each employee returned by the cursor.
d) Scan through the list of employees in the PL/SQL table, keeping count of all
salaries greater than $50,000. Don't even start the scan, though, if the table is empty
or if today is a Saturday or if the first employee in the PL/SQL table is the president
of the company.