Generate Package¶
This context menu item will generate stored packages based on the data you have entered in the Job header + Structure folder. As you may want to have different appearance of the message triggered On Insert from the message triggered On Update, 2 packages will be generated for each replication job. The package will be plain PL/SQL code, with cursors selecting data from specified view, LOOPs to format the message, and finally a procedure call that creates the outbound message in Connectivity.
Naming convention¶
Package names will start with prefix 'RPL' + name of replication job + trigger-mode (I for INSERT or U for UPDATE). This means that if you have defined a job with Job ID = CUST_INFO, the package names for this job will be:
RPL_CUST_INFO_I and
RPL_CUST_INFO_U
Both packages will have 1 procedure defined, with name Create_Message
Within the packages, names of cursors, loops and records will be suffixed with the number value of the sequence in the 'Structure' folder.
In-parameters¶
The procedure Create_Message will have an attribute-string as in-parameter. This attribute-string should contain primary key for the master view with specific values. Generated triggers will invoke the procedure using this attribute string.
Local variables¶
All key columns will be declared as local variables at top of the procedure. These variables are maintained within each LOOP.
Cursors¶
Each defined view in the 'Structure' folder will become a cursor, selecting columns as specified under RMB 'Define Columns'. The WHERE-clause for the cursor is either default generated, based on key-columns, or it is a manual WHERE-clause defined in column 'Select Where' in the 'Structure' folder.
Each cursor will have a connected record declaration.
LOOPs¶
The first action after the BEGIN-statement, is that primary key variables get their values from the incoming attribute string.
After that, the LOOP sequence starts with record-declarations, formatting and array/aggregate-definitions. Each LOOP ends with updating local key-variables. This is necessary to ensure that nested loops pass on key-values to next level.
Finally, the procedure PLSQLAP_Server_API.Post_Outbound_BizAPI is invoked, with parameters fetched from the Job header.