gen and save child id
Overview
This function generates a unique child ID for the inherited ID of the supplied parent_id and inserts it into the target_k_table.
This is an insert-select function and must be used in set-based
insert…select SQL statements. This can only be used to map expressions in TableSet targets.
Parameters
| Parameter | Description |
|---|---|
| id_name | Name of the ID. Type: varchar2 |
| id_size | Specifies the length of the ID to generate. Type: number |
| target_k_table | Specifies where the generated child and inherited IDs will be inserted. Type: varchar2 |
| parent_id | Specifies the parent ID used to generate the child and inherited IDs. Type: varchar2 |
| env_id | Specifies the ID of the source environment. Type: number |
| thread_number | Specifies the actual thread number if the function is invoked from multiple threads to prevent generating duplicate IDs, which will result in unique constraint errors at the time of commit. Type: number Default: 1 |
| thread_count | Specifies the actual thread count if the function is invoked from multiple threads to prevent generating duplicate IDs, which will result in unique constraint errors at the time of commit. Type: number Default: 1 |
| inherited_id_size | Specifies the number of digits to copy from the parent_id to generated_id. If the id_size is more than the inherited_id_size, the remaining digits are randomly generated.Type: number Default: 6 |
| max_retries | Specifies the number of retries the generation will run if a duplicate ID already exists in the target_k_table.Type: number Default: 10 |
| generated_id | Indicates the generated ID after the function is executed. Type: varchar2 |
Example
The following mapping expression generates a new 12-digit BILL_ID and inserts the id into the CI_BILL_K table. The first 6 digits of the BILL_ID will be the same as the first 6 digits of the ACCT_ID, and the remaining 6 digits would be randomly generated.
ria_dih.gen_and_save_child_id('BILL_ID',
12,
'CI_BILL_K',
ACCT_ID,
{ENV_ID},
{$threadNumber},
{$threadCount})
The {$threadNumber} and {$threadCount} variables allow the generation function to work in multiple threads.