MySQL Forums
Forum List  »  Newbie

Re: handling errors with number conversion
Posted by: Barry Galbraith
Date: May 07, 2017 09:33PM

Does this help? Convert strings to numbers by adding 0.

mysql> select '+1' + 0;
+----------+
| '+1' + 0 |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)

mysql> select '-10.00' + 0;
+--------------+
| '-10.00' + 0 |
+--------------+
|          -10 |
+--------------+
1 row in set (0.00 sec)

mysql> select 'english' + 0;
+---------------+
| 'english' + 0 |
+---------------+
|             0 |
+---------------+
1 row in set, 1 warning (0.00 sec)

mysql>

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: handling errors with number conversion
May 07, 2017 09:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.