Pad the string on the right with spaces or the named character. If the string is already padded, as happens with a CHARACTER datatype, the string must first be trimmed using the TRIM function.
This function returns a STRING datatype.
$RPAD( character_expression, num_characters [, pad_character] )
Required. Any expression that returns a character-class datatype. Examples of expressions are columns, concatenations of columns, literal strings and functions that return a character datatype.
Required. The number of characters to be returned from the function, with the right-most characters padded with spaces or the named character.
Optional. The character to be used to pad the string. If this parameter is omitted, then a space is used as the pad character.
In this example, the name must first be trimmed since it is already padded with spaces.
> select $rpad(trim(name), 40, '.') nme from individuals; NME ---------------------------------------- MS. MARY LEWIS.......................... MRS. ALICE R TOLLIVER................... MR. SIDNEY K TOLLIVER................... MRS. JENNIFER J HOPKINS................. MR. CHARLIE HOPKINS..................... MS. KIMBERLY BLUE....................... KATHLEEN TUCKER.........................
See also: