gen and save id
Overview
This function generates a unique random ID for the id_name and inserts it into the target_k_table, which must contain only the ID and ENV_ID columns.
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 ID will be inserted. 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 |
| max_retries | Specifies the number of retries the generation will run if a duplicate ID already exists in the
|
| generated_id | Indicates the generated ID after the function is executed. Type: varchar2 |
Example
The following mapping expression generates a new 12-digit FT_ID and inserts the ID into the CI_FT_K table with the provided ENV_ID.
ria_dih.gen_and_save_id('FT_ID',
12,
'CI_FT_K',
{ENV_ID},
{$threadNumber},
{$threadCount})
The {$threadNumber} and {$threadCount} variables allow the generation function to work in multiple threads.