Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert string to double (NOT decimal)

I have a table of double precision values, and I need to insert new values calculated from strings with numeric meaning.

MySQL doesn't seem to allow such conversion:

select cast('3.33' as double);

(error)

select cast('3.33' as decimal(3,2));

(works, but it's not what I need).

like image 504
Ferdinand.kraft Avatar asked Nov 29 '22 14:11

Ferdinand.kraft


1 Answers

Workaround:

select '3.33' + 0.0;
like image 129
Ferdinand.kraft Avatar answered Dec 08 '22 00:12

Ferdinand.kraft