Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

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



Concatenation Operator

Description

A concatenation operator gets a character string or bit string data type as an operand and returns a concatenated string. The plus sign (+) and double pipe symbol (||) are provided as concatenation operators for character string data. If NULL is specified as an operand, a NULL value is returned.

If pipes_as_concat that is a parameter related to SQL statement is set to no (default value: yes), a double pipe (||) symbol is interpreted as an OR operator. If plus_as_concat is set to no (default value: yes), a plus (+) symbol is interpreted as a plus (+) operator. In such case, It is recommended to concatenate strings or bit strings, by using the CONCAT function.

Syntax

concat_operand1   +  concat_operand1

concat_operand2   ||  concat_operand2

concat_operand1 :

• bit string

NULL

 

concat_operand2 :

• bit string

• character string

NULL

  • concat_operand1 : Left string after concatenation. String or bit string can be specified.
  • concat_operand2 : Right string after concatenation. String or bit string can be specified.
Example

SELECT 'CUBRID' || ',' + '2008';

 'CUBRID'||','+'2008'

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

  'CUBRID,2008'

 

SELECT 'cubrid' || ',' || B'0010' ||B'0000' ||B'0000' ||B'1000';;

 'cubrid'||','||B'0010'||B'0000'||B'0000'||B'1000'

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

  'cubrid,2008'

 

SELECT ((EXTRACT(YEAR FROM SYS_TIMESTAMP))||(EXTRACT(MONTH FROM SYS_TIMESTAMP)));

 (( extract(year  from  SYS_TIMESTAMP ))||( extract(month  from  SYS_TIMESTAMP )))

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

  '200812'

 

SELECT 'CUBRID' || ',' + NULL;

 'CUBRID'||','+null

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

  NULL