Output of MySQL ELT Function with Non-Integer Index



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: 2020-06-20T08:56:38+05:30

103 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements