SPACE()

Documentation

Home » Documentation » Using VoltDB

SPACE()

SPACE() — Returns a string of spaces of the specified length.

Synopsis

SPACE( numeric-expression )

Description

The SPACE() function returns a string composed of n spaces where the string length n is specified by the function's argument. SPACE(n) is a synonym for REPEAT(' ', n).

Example

The following example uses the SPACE and CHAR_LENGTH functions to ensure the result is a fixed length, padded with blank spaces.

 SELECT product_name || SPACE(80 - CHAR_LENGTH(product_name))
    FROM product_list ORDER BY product_name;