Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 



SPACE Function

Description

The SPACE function returns as many empy strings as the number specified. The return value is a VARCHAR type.

Syntax

SPACE(N)

  • N : Space count. It cannot be greater than the value specified in the system parameter, string_max_size_bytes (default 1048576). If it exceeds the specified value, NULL will be returned. The maximum value is 33,554,432; if this length is exceeded, NULL will be returned. If you enter 0 or a negative number, an empty string will be returned; if you enter a type that can't be converted to a numeric value, an error will be returned.
Example

SELECT SPACE(8);

   space(8)

======================

  '        '

 

SELECT LENGTH(space(1048576));

   char_length( space(1048576))

===============================

                        1048576

 

SELECT LENGTH(space(1048577));

   char_length( space(1048577))

===============================

                           NULL

 

-- string_max_size_bytes=33554432

SELECT LENGTH(space('33554432'));

   char_length( space('33554432'))

==================================

                          33554432

 

SELECT SPACE('aaa');

 

ERROR: Cannot coerce value of domain "character" to domain "bigint".