Home > Database > Mysql Tutorial > What happens if the value of the number 'N' in the CONV() function does not match its base?

What happens if the value of the number 'N' in the CONV() function does not match its base?

PHPz
Release: 2023-08-27 14:29:10
forward
1079 people have browsed it

如果 CONV() 函数中数字“N”的值与其基数不符会发生什么?

If the number given in the CONV() function does not match its base, MySQL will return 0 as output. Suppose, if we want to convert the decimal number 9 to a 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 will return 0 as output.

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

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

1 row in set (0.00 sec)
Copy after login

We know that octal values ​​must be between 0 and 7, so the number system for the number 9 must be decimal, which is 10.

The above is the detailed content of What happens if the value of the number 'N' in the CONV() function does not match its base?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template