What would be the output of MySQL ELT() function if the index number, provided as an argument, is not an integer?


As we know the 1st argument of ELT() function must be an integer value but when we provide index number which is not an integer the MySQL ELT() function returns NULL with 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)

Updated on: 20-Jun-2020

62 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements