12.9. Cleaning Up Source and Target

PLVio provides several programs so that you can clean up after yourself when using the package. These programs are described below.

12.9.1. Closing the Source

When you are done reading from the source repository, you should close it. The header for the closesrc procedure is:

PROCEDURE closesrc;

If the source is a database table, closesrc closes the dynamic SQL cursor. If the source is a file, the procedure closes the file. For a string or PL/SQL table source, no action is taken.

It is extremely important that you close your source; otherwise, a cursor or file will remain open for the duration of your session. This could lead to errors or unnecessary memory utilization.

The closesrc program will also automatically restore the PLVio settings if they were saved (i.e., if PLVio.saving_src returns TRUE).

12.9.2. Closing the Target

When you are done writing to the target repository, you should close it. The header for the closetrg procedure is:

PROCEDURE closetrg;

If the target is a database table, then closetrg calls PLVcmt.perform_commit to save your writes to the target (you can disable the commit with a call to PLVcmt.turn_off). If the source is a file, the procedure closes the file. For a string or PL/SQL table source, no action is taken.

When your target is a database table or a file, it is extremely important that you close your target. If you skip this step for a file, for example, that file might remain open for the duration of your ...

Get Advanced Oracle PL/SQL Programming with Packages 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.