Collections:
Converting Character Strings to Numeric Values in MySQL
How To Convert Character Strings to Numeric Values in MySQL?
✍: FYIcenter.com
You can convert character strings to numeric values by using the CAST(string AS DECIMAL) or CAST(string AS SIGNED INTEGER) function as shown in the following examples:
SELECT CAST('4123.45700' AS DECIMAL) FROM DUAL;
4123.46
-- Very poor conversion
SELECT CAST('4.12345700e+3' AS DECIMAL) FROM DUAL;
4123.46
-- Very poor conversion
SELECT CAST('4123.45700' AS SIGNED INTEGER) FROM DUAL;
4123
SELECT CAST('4.12345700e+3' AS SIGNED INTEGER) FROM DUAL;
4
-- Very poor conversion
⇒ Using IN Conditions in MySQL
⇐ Converting Numeric Values to Character Strings in MySQL
2018-03-28, 2449🔥, 0💬
Popular Posts:
What Is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is ...
Can You Drop an Index Associated with a Unique or Primary Key Constraint in Oracle? You can not dele...
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...
How To Generate CREATE TABLE Script on an Existing Table in SQL Server? If you want to know how an e...
How To List All User Names in a Database in SQL Server? If you want to see a list of all user names ...