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 | 



ELT Function

Description

If N is 1, the ELT function returns string1 and if N is 2, it returns string2. The return value is a VARCHAR type. You can add conditional expressions as needed.

The maximum length of the character string is 33,554,432 and if this length is exceeded, NULL will be returned.

If N is 0 or a negative number, an empty string will be returned. If N is greater than the number of this input character string, NULL will be returned as it is out of range. If N is a type that cannot be converted to an integer, an error will be returned.

Syntax

ELT(N, string1, string2, ... )

 

string :

character string

NULL

Example

SELECT ELT(3,'string1','string2','string3');

  elt(3, 'string1', 'string2', 'string3')

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

  'string3'

 

SELECT ELT('3','1/1/1','23:00:00','2001-03-04');

  elt('3', '1/1/1', '23:00:00', '2001-03-04')

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

  '2001-03-04'

 

SELECT ELT(-1, 'string1','string2','string3');

  elt(-1, 'string1','string2','string3')

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

  NULL

 

SELECT ELT(4,'string1','string2','string3');

  elt(4, 'string1', 'string2', 'string3')

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

  NULL

 

SELECT ELT(3.2,'string1','string2','string3');

  elt(3.2, 'string1', 'string2', 'string3')

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

  'string3'

 

SELECT ELT('a','string1','string2','string3');

 

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