How to convert string into a decimal?

mysql, ruby, ruby-on-rails

Solution

try using `CAST`

SELECT CAST(colName AS DECIMAL(10,2))
FROM tableName

- SQLFiddle Demo

Problem

I have two strings "0.31" and "0.0076" and they need to be stored in a decimal(10,2) column in MySQL. How do I do this conversion in ruby but not in mysql directly

Original source