All pastes #174888 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-09-18 08:43 UTC
rendered paste body
mysql> SELECT CAST(25.1 AS DECIMAL(5,5));                                              
+----------------------------+                                                         
| CAST(25.1 AS DECIMAL(5,5)) |                                                         
+----------------------------+                                                         
|                   25.10000 |                                                         
+----------------------------+                                                         
mysql> DESCRIBE vendors_products;                                                      
...                                                                                    
 Field             | Type                  | Null | Key | Default | Extra |            
| vendor_unit_cost  | decimal(5,5)          | NO   |     |         |       |           
mysql> UPDATE vendors_products SET vendor_unit_cost=25.1 WHERE sku=10027;              
Query OK, 0 rows affected, 1 warning (0.00 sec)                                        
Rows matched: 1  Changed: 0  Warnings: 1                                               
mysql> SHOW WARNINGS;                                                                  
+---------+------+--------------------------------------------------------------------+
| Level   | Code | Message                                                            |
+---------+------+--------------------------------------------------------------------+
| Warning | 1264 | Out of range value adjusted for column 'vendor_unit_cost' at row 1 |
+---------+------+--------------------------------------------------------------------+
1 row in set (0.01 sec)                                                                
mysql> SELECT vendor_unit_cost FROM vendors_products WHERE sku=10027;                  
+------------------+                                                                   
| vendor_unit_cost |                                                                   
+------------------+                                                                   
|          0.99999 |
+------------------+