laravel SQLSTATE[22003]:数值超出范围:1264 超出范围值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48681491/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 17:21:35  来源:igfitidea点击:

SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value

mysqllaravel

提问by Omae wa mou shindairu

in my decimal from WAMP server is decimal (5,2) My QueryException:

来自 WAMP 服务器的十进制数是十进制数 (5,2) 我的 QueryException:

SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'converted_1000ml' at row 1 (SQL: insert into inventory_databanks(product_desc, nc_os, ncos_value, del, ei, sa, wh, bi, brand, variant, type, content, conversion_1000ml, **converted_1000ml**, os, bo, peso_sales, bo_case, os_case, del_case, wh_case, sa_case, price, facing, maker, merchandiser_name, complete_address, source_type, payroll_period, cellphone, schedule, area, region, province, city_municipality, outlet, edi_branch, salesman, ns_case1, ns_case2, ns_case3, ns_bottles1, ns_bottles2, ns_bottles3, ns_date1, ns_date2, ns_date3, date_started, inventory_date, updated_at, created_at) values (Emperador_Light 1000mL Light Brandy, With Stocks, With Stocks, 2400, 4734, 78, 4656, 245, Emperador_Light, Brandy, Original, 1000, 1.00, 4734.00, 0, 0, -229790, 0, 0, 0, 0, 0, 110.00, 13, EDI, Rodolfo Siongco Jr, null, From Inventory Sheet, 01/16/2018 - 01/31/2018, 09303243249, T-TH-S, Central Luzon, Region III, Bataan, Mariveles, CORA'S, Pampanga Branch, Angelito Quetua, 0, 0, 0, 0, 0, 0, 2018-01-31, 2018-01-31, 2018-01-31, 2018-01-16, 1970-01-01, 2018-02-08 08:49:48, 2018-02-08 08:49:48))

SQLSTATE[22003]:数值超出范围:1264 列 'converted_1000ml' 在第 1 行的超出范围值(SQL:插入到inventory_databanks( product_desc, nc_os, ncos_value, del, ei, sa, wh, bi, brand, variant, type, content, conversion_1000ml, **converted_1000ml**, os, bo, peso_sales, bo_case, os_case, del_case, wh_casesa_casepricefacingmakermerchandiser_namecomplete_addresssource_typepayroll_periodcellphoneschedulearearegionprovincecity_municipalityoutletedi_branchsalesmanns_case1ns_case2ns_case3ns_bottles1ns_bottles2ns_bottles3ns_date1ns_date2ns_date3date_started, inventory_date, updated_at, created_at) 值 (Emperador_Light 1000mL Light Brandy, With Stocks, With Stocks, 2400, 4734, 78, 4656, 245, Emperador_Light, Brandy, Original, 1000, 1.00, 4734.00, -07, 209 0, 0, 0, 110.00, 13, EDI, Rodolfo Siongco Jr, null, From Inventory Sheet, 01/16/2018 - 01/31/2018, 09303243249, T-TH-S, Central Luzon, Region III, Batan, Mariveles, CORA'S, Pampanga Branch, Angelito Quetua, 0, 0, 0, 0, 0, 0, 2018-01-31, 2018-01-31, 2018-01-31, 2018-01-16, 1970-01- 01, 2018-02-08 08:49:48, 2018-02-08 08:49:48))

How can i fix this? bold numbers i think this is my problem

我怎样才能解决这个问题?粗体数字我认为这是我的问题

回答by

decimal (5,2) has a range of -999.99 to 999.99. You will have to change that column in order to hold large values.

十进制 (5,2) 的范围是 -999.99 到 999.99。您必须更改该列才能保存大值。

salary DECIMAL(5,2)

In this example, 5 is the precision and 2 is the scale. The precision represents the number of significant digits that are stored for values, and the scale represents the number of digits that can be stored following the decimal point.

Standard SQL requires that DECIMAL(5,2) be able to store any value with five digits and two decimals, so values that can be stored in the salary column range from -999.99 to 999.99.

工资 DECIMAL(5,2)

在本例中,5 是精度,2 是比例。精度表示为值存储的有效位数,小数位数表示小数点后可以存储的位数。

标准 SQL 要求 DECIMAL(5,2) 能够存储任何五位数和两位小数的值,因此可以存储在薪水列中的值范围从 -999.99 到 999.99。

Documentation

文档