joe*_*joe 2 oracle date-format errors date
这里是 Oracle 的新手,我正在处理一些分配,但我注意到当我使用脚本创建表时,oracle 抛出以下错误:
ORA-01858: a non-numeric character was found where a numeric was expected
01858. 00000 - "a non-numeric character was found where a numeric was expected"
*Cause: The input data to be converted using a date format model was
incorrect. The input data did not contain a number where a number was
required by the format model.
*Action: Fix the input data or the date format model to make sure the
elements match in number and type. Then retry the operation.
Run Code Online (Sandbox Code Playgroud)
知道我的查询中的日期格式类似于“01-JUN-2012”,我想知道如何更改 oracle 安装中的默认格式以满足我的系统格式?我正在使用带有免费 Oracle 版本 11g 的 SQL Developer。
我也想知道这是不是因为我的电脑是 WIN 7 法语版,我的查询中的日期是美国英语格式?
UPDATE bb_product
set salestart = '01-JUN-2012', saleend = '15-JUN-2012', SalePrice = 8.00
WHERE idProduct = 6;
Run Code Online (Sandbox Code Playgroud)
这个查询来自我的教授分发的 Brewer Beans DB。我假设它是在使用 EN-US 格式的系统中创建的...有什么帮助吗?
您通常不想依赖字符串到日期的隐式转换。这只会导致痛苦和痛苦,因为不同的用户会有不同的日期格式。使用 ANSI 日期文字或使用to_date
带有显式格式掩码的函数
UPDATE bb_product
SET salestart = date '2012-06-01',
saleend = date '2012-06-15',
saleprice = 8
WHERE idProduct = 6
Run Code Online (Sandbox Code Playgroud)
或者
UPDATE bb_product
SET salestart = to_date('01-JUN-2012', 'DD-MON-YYYY'),
saleend = to_date('15-JUN-2012', 'DD-MON-YYYY'),
saleprice = 8
WHERE idProduct = 6
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13984 次 |
最近记录: |