sean c peters wrote:

Hi all. I am trying to figure out if there is a way to configure MySQL so that when inserts occur on decimal fields where the value being inserted has more precision than the field specification, then the value inserted is rounded instead of truncated.

Rounding is what does happen...

For example, if i have a column:
Acres DECIMAL(14,3) NOT NULL DEFAULT 0

and i'm inserting the value '1.5467'

unless you insert a string.

currently, the value 1.546 is inserted.

"Currently" means which version?

But i want the behaviour to round this number to 1.547

Is this possible, or will i have to do that manually (programmatically) for all the decimal fields that i want to behave this way.

Note: The application htat i need this for is driven by Perl with the DBI / DBD::MySQL

Are you using prepared statements?  Perhaps Perl is quoting your decimals for 
you.

Thanks much

It's a known bug <http://bugs.mysql.com/bug.php?id=10719>. The workaround is to insert the value 1.5467 rather than '1.5467'.

Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to