12.5. Managing the Target Repository

After reading about how to manage the source repository, you will probably be relieved to find that there is much less complexity involved in working with the target repository. Since the target is on the receiving end, there is no need to fiddle with the WHERE clause. You simply set and initialize the target, and then you are ready to write into that repository.

The settrg procedure defines the type of repository and its structure. The header for settrg is:

PROCEDURE settrg
   (trgtype_in IN VARCHAR2,
    name_in IN VARCHAR2 := 'PLV_source',
    target_name_col_in IN VARCHAR2 := 'name',
    trgtype_col_in IN VARCHAR2 := 'type',
    target_line#_col_in IN VARCHAR2 := 'line',
    target_text_col_in IN VARCHAR2 := 'text');

The first argument, trgtype_in, is the type of repository. The second argument, name_in, is the name of the repository. Its content varies according to the type of repository and is explained below. The third through sixth arguments provide the names of the columns required for a database table target. The default values match the structure of the default table (PLV_source).

The settrg procedure transfers the arguments to the trgrep record, which is defined using the repos_rectype shown earlier. If you are using a database target, then the INSERT statement that will be used to write lines to that table is constructed as follows:

trgrep.insert_sql := 'INSERT INTO ' || trgrep.name || '( ' || target_name_col_in || ', ' || trgtype_col_in || ', ' || ...

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.