STRING function

The STRING function returns a random string.

Syntax

Read syntax diagramSkip visual syntax diagramDBMS_RANDOM.STRING(opt,len)

Description

opt
An expression that returns CHAR(1). Specifies the operating mode and determines what the result should contain. The following values are valid:
'L' or 'l'
Lowercase ASCII characters only
'U' or 'u'
Uppercase ASCII characters only
'P' or 'p'
Printable ASCII characters only
'A' or 'a'
Combination of uppercase and lowercase ASCII characters
'X' or 'x'
Combination of uppercase ASCII characters and numbers

Any other input will default to uppercase ASCII characters, similar to 'U'.

len
An expression that returns an INTEGER. Specifies the length of the resulting random string, up to a maximum of 4000.

If opt is NULL, then the result will default to uppercase ASCII characters, similar to 'U'.

If len is NULL, then a zero length string will be returned.

Note: Calling STRING before seeding the random number generator explicitly by calling SEED, SEED_STRING, or INITIALIZE defaults to using a seed that is based on the system current timestamp.