Here is a float, declared in PHP:
$floatValue = 6.66;
Saving it to an Oracle database like this works fine:
$statement = $connection->prepare("INSERT INTO fooTable (numValue) VALUES($floatValue)");
$statement->execute();
//All good!
However, if I use bindParam, error ORA-01722 is raised:
$statement = $connection->prepare("INSERT INTO fooTable (numValue) VALUES(?)");
$statement->bindParam(1, $floatValue);
$statement->execute();
//ORA-01722 raised
This only happens with floats, ints are fine.
I tried changing the decimal separator in my OS, no problem there.
So what's happening here?
Why only floats?
Is there an alternative to bindParam specificaly for Floats..?