Lab 21.1 Exercises
21.1.1 Access Files with UTL_FILE
Complete the following exercises:
a) | Create a companion procedure to the example procedure LOG_USER_COUNT, name your proceudre READ_LOG. This procedure will read a text file and display each line via DBMS_OUTPUT.PUT_LINE. |
b) | Run the procedure LOG_USER_COUNT and then run the procedure READ_LOG for the same file. |
21.1.2 Schedule Jobs with DBMS_JOB
Complete the following exercises:
a) | Create a procedure DELETE_ENROLL that will delete all student enrollments if there are no grades in the GRADE table for that student's enrollment and the start date of the section is already one month past. |
b) | Submit the procedure DELETE_ENROLL to execute one a month. |
21.1.3 Generate an Explain Plan with DBMS_XPLAN
Complete the following exercises:
a) | Find out if your schema has a table named PLAN_TABLE that matches the DDL in the Plan table script ch21_1a.sql. If it does not, then use the above script to create the PLAN_TABLE. |
b) | Compute statistics on all tables in your schema using a single SQL statement to generate the command. |
c) | The following SQL statement generates a list of the open sections in courses that the student with the ID of 214 is not enrolled in. There are many different SQL statements that would produce the same result. Since various in-line views are required, it is important to examine the execution plan to determine which plan will produce the result with the least COST to the database. Run the SQL as follows to generate an SQL plan.
|
d) | Use the DBMS_XPLAN package as a means to see the execution plan of the SQL statement. |
e) | Generate an alternative SQL that will produce the same results and then examine the explain plan. |
21.1.4 Create an HTML Page with the Oracle Web Toolkit
Complete the following exercises:
a) | Create a PL/SQL procedure that will generate the following HTML page.
|
b) | Generate an update page for the form action in the last HTML page. This update will be the form handler for the SUBMIT button, it will commit the changes to the database and then refresh the page. |