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.

Parameters

ParameterDescription
id_nameName of the ID.

Type: varchar2
id_size

Specifies the length of the ID to generate.

Type: number

target_k_tableSpecifies where the generated ID will be inserted.

Type: varchar2
env_idSpecifies the ID of the source environment.

Type: number
thread_numberSpecifies 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_countSpecifies 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 target_k_table.


Type: number
Default: 5

generated_idIndicates 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.