简体   繁体   English

ORA-01858:找到一个非数字字符,其中数字是预期的? 即使数值是数字?

[英]ORA-01858: a non-numeric character was found where a numeric was expected? Even when the values are numbers?

This is the table 这是表格

    CREATE TABLE Employee
    (EmpID number(5) primary key,
    SIN Number(9) Not null,
    LastName Varchar2(25) Not null,
    FirstName Varchar2(25),
    Street Varchar2(30),
    City Varchar2(25),
    Province Char(2),
    PostalCode Varchar2(7),
    JobCode Number(4) Not null,
    Foreign Key(JobCode) REFERENCES Job,
    IncomeTax Char(1),
    BirthDate Date,
    HireDate Date,
    JobCodeDate Date)
    TABLESPACE users;

This is the line I am trying to insert, there is only three numeric values and all of them are numbers as far as I can see. 这是我试图插入的行,只有三个数值,所有这些都是数字,据我所见。

INSERT INTO Employee VALUES(97319,516303417,'Novak','Gerry','6803 Park Ave.','Moose Jaw','SK','S6H 1X7',3000,'N','24-Aug-86','07-Jul-03','07-Jul-03');

ERROR at line 1:
ORA-01858: a non-numeric character was found where a numeric was expected

I believe the issue is with the date columns try using this syntax to_date('07-Jul-03','DD-MON-YY') : 我相信问题是日期列尝试使用此语法to_date('07-Jul-03','DD-MON-YY')

INSERT INTO Employee 
VALUES(97319,516303417,'Novak','Gerry','6803 Park Ave.','Moose Jaw','SK','S6H 1X7',3000,'N',to_date('24-Aug-86', 'DD-MON-YY'),to_date('07-Jul-03','DD-MON-YY'),to_date('07-Jul-03','DD-MON-YY'));

SQL-Fiddle: http://sqlfiddle.com/#!4/0e9df/2 SQL-Fiddle: http ://sqlfiddle.com/#!4/0e9df/2

alter SESSION set NLS_DATE_FORMAT = 'DD-Mon-YY';

我只需输入此内容,以便sql将正确执行插入查询中的日期格式

There's possibly a discrepancy between the order of fields as laid out in the INSERT statement, and the order that Oracle is expecting them. INSERT语句中列出的字段顺序与Oracle期望它们的顺序之间可能存在差异。 I suggest trying again using the full syntax of the INSERT (ie specify field names when doing the INSERT). 我建议再次尝试使用INSERT的完整语法(即在执行INSERT时指定字段名称)。 That way, it's absolutely clear the value to field correlation being made. 这样,绝对清楚地表明了场相关的价值。

So something like this: 所以像这样:

INSERT 
INTO Employee (EmpID, SIN, LastName, FirstName, Street, City, Province, PostalCode, JobCode, IncomeTax, BirthDate, HireDate, JobCodeDate)
VALUES(97319,516303417,'Novak','Gerry','6803 Park Ave.','Moose Jaw','SK','S6H 1X7',3000,'N','1986-08-24','2003-07-07','2003-07-07');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 ORA-01858:在运行查询时应为数字的位置发现了非数字字符 - Error ORA-01858: a non-numeric character was found where a numeric was expected when running query ORA-01858:在期望数字的地方找到了非数字字符? - ORA-01858: a non-numeric character was found where a numeric was expected? ORA-01858: 在需要数字的地方发现了一个非数字字符(时间戳、解码) - ORA-01858: a non-numeric character was found where a numeric was expected (timestamp, decode) 可能的日期分配错误ORA-01858:在期望数字的位置找到了非数字字符 - Possible Date assignment error ORA-01858: a non-numeric character was found where a numeric was expected ORA-01858: 在需要数字的地方发现了一个非数字字符 - ORA-01858: a non-numeric character was found where a numeric was expected 看到 ORA-01858:在需要数字的地方发现了一个非数字字符 - Seeing ORA-01858: a non-numeric character was found where a numeric was expected ORA-01858: 在一个简单的选择查询需要数字的地方发现了一个非数字字符 - ORA-01858: a non-numeric character was found where a numeric was expected for a simple select query ORA-01858:找到一个非数字字符,其中数字是预期的 - oracle 10g - ORA-01858: a non-numeric character was found where a numeric was expected - oracle 10g .NET ORA-01858:找到了一个非数字字符,其中包含数字 - .NET ORA-01858: a non-numeric character was found where a numeric was expected ORA-01858:预期数字时找到非数字字符 - ORA-01858: a non-numeric character was found when a numeric was expected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM