Home  >  Article  >  Database  >  What is the output of the MySQL ELT() function if the index number supplied as a parameter is not an integer?

What is the output of the MySQL ELT() function if the index number supplied as a parameter is not an integer?

PHPz
PHPzforward
2023-09-01 23:25:141285browse

如果作为参数提供的索引号不是整数,MySQL ELT() 函数的输出是什么?

As we know, the first parameter of the ELT() function must be an integer value, but when the index number we provide is not an integer, MySQL's ELT() function will Return NULL and display a warning.

Example

mysql> select ELT('one','Ram,is,good,boy')As Result;
+--------+
| Result |
+--------+
| NULL   |
+--------+
1 row in set, 1 warning (0.00 sec)

mysql> Show Warnings;
+---------+------+------------------------------------------+
| Level   | Code | Message                                  |
+---------+------+------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'one' |
+---------+------+------------------------------------------+
1 row in set (0.00 sec)

The above is the detailed content of What is the output of the MySQL ELT() function if the index number supplied as a parameter is not an integer?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete