Syntax error What happens if the value of number ‘N’ in CONV() function is not as per accordance with its base?

What happens if the value of number ‘N’ in CONV() function is not as per accordance with its base?



MySQL returns 0 as output if the number given in CONV() function is not as per accordance with its base. Suppose, if we want to convert decimal number 9 into the number in binary number system then in this case the value of from_base must be 10 but if we provide 8 as the value of from_base then MySQL returns 0 as output.

Example

mysql> Select CONV(9,8,2);

+-------------+
| CONV(9,8,2) |
+-------------+
| 0           |
+-------------+

1 row in set (0.00 sec)

As we know that the values of octal number system must be between 0 to 7, hence the number system for number 9 must be decimal i.e. 10.

Updated on: 2020-02-04T05:57:20+05:30

156 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements