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 | 

FIELD Function


The FIELD function returns the location index value (position) of a string of string1, string2. The function returns 0 if it does not have a parameter value which is the same as search_string. It returns 0 if search_string is NULL because it cannot perform the comparison operation with the other arguments.

If all arguments specified for FIELD() are of string type, string comparison operation is performed: if all of them are of number type, numeric comparison operation is performed. If the type of one argument is different from that of another, a comparison operation is performed by casting each argument to the type of the first argument. If type casting fails during the comparison operation with each argument, the function considers the result of the comparison operation as FALSE and resumes the other operations.


FIELD( search_string, string1 [,string2 [, ... [, stringN]...]])


string :

? character string



SELECT FIELD('abc', 'a', 'ab', 'abc', 'abcd', 'abcde');





--it returns 0 when no same string is found in the list

SELECT FIELD('abc', 'a', 'ab', NULL);





--it returns 0 when null is specified in the first parameter