RANDOM_TEXT
Syntax
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> | | RANDOM_TEXT[RANDOM_TEXT]:::quoted
RANDOM_TEXT --> End((END))
Purpose
The RANDOM_TEXT SQL function generates a text with pseudo-random values taken from a list of possible characters.
See also RANDOM and RANDOM_BLOB.
Parameters:
- Length (
int32): Produce a text with this length in terms of characters, from 0 to 67,108,864. - Candidates (
varchar2): List of characters to choose from. The same character may appear multiple times.
Returns: A text with pseudo-random values.
Examples
The following example generates a text of 10 pseudo-random characters taken from abc; the actual value differs per invocation:
select random_text(10, 'abc')
-------------------
bacbcabbca
The following example generates a text of 10 pseudo-random characters and retrieves the length in characters:
select length(random_text(10, '23456789ABCDEFGHJKLMNPQRSTUVWXYZ'))
-------------------
10