Expert

28-33.

In 28-32, you correctly encoded a parameter’s value because you already knew its format. This is usually not the case. Write a general function that can encode any string into CGI (Common Gateway Interface) format. Test your function using the value “The date {05/21/1994}”. It should return the string “the+date+%7B05%2F21% 2F1994%7D”.

28-34.

Your company uses an online system that allows employees to fill out expense reports, which are stored in a table. At the end of each month, there are usually several thousand records. On May 1st, the Payables department asks you to write a system to monitor employee expenses, and you dutifully comply by writing a PL/SQL procedure. Everything works fine. On May 21st, you start receiving complaints that the system is “slow,” and the next week you receive a call that it has blown up entirely, displaying the message “Internal Error.” What might be happening, and how can you fix the problem?

28-35.

A programmer has written the following procedure:

CREATE OR REPLACE PROCEDURE foo AS
    x NUMBER DEFAULT 1;
  BEGIN
    LOOP
       EXIT WHEN x = 0;
       x := x + 1;
      IF x > 100 THEN
         x := 1;
      END IF;
   END LOOP;
   HTP.PRINT('All done!');
END;

When the programmer calls it from the Web, the browser simply hangs and never returns the expected output. He presses the “Stop” button and rechecks the code. After finding the bug that caused the program to hang, he attempts to recompile the procedure. This time, the compiler itself hangs for several minutes. Eventually, it returns ...

Get Oracle PL/SQL Programming: A Developer's Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.