SQL-ORA-00911-尝试插入记录时出现无效字符 [英] SQL - ORA-00911 - Invalid Character while trying to insert records
本文介绍了SQL-ORA-00911-尝试插入记录时出现无效字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Oracle Live SQL. 我正在尝试为表插入记录.该表通过得很好,但是在每行记录中,我显然输入了一些无效字符.当然,这是一个非常模糊的错误.我不知道怎么了.
Oracle Live SQL. I am trying to insert records for a table. The table goes through just fine but in each line of records, I am apparently entering some invalid characters. Of course, this is an extremely vague error. I don't know what's wrong.
我尝试过更改日期值,尝试单独删除值,但是无论遇到什么错误,都可以.
I've tried changing the date values, tried removing values individually, but no matter what I get the same error.
CREATE TABLE Employee_Information (
employee varchar2(25) NOT NULL,
Address varchar2(50) NOT NULL,
Phone_number CHAR(10) NOT NULL,
Hire_date date,
Position varchar2(20),
Sales_Numbers varchar2(4),
Salary varchar2(6),
PRIMARY KEY(employee)
);
INSERT INTO Employee_Information (employee, address, phone_number,
hire_date, position, sales_numbers, salary)
VALUES (‘John Smith’, ‘123 1st street’, 5554622919, '2017-11-25', ‘assistant manager’, null, 55000);
INSERT INTO Employee_Information (employee, address, phone_number, hire_date, position, sales_numbers, salary)
VALUES (‘Bob Goldman’, ‘321 2nd street’, 5553392454, '2018-12-13', ‘cashier’, 345, 38000);
INSERT INTO Employee_Information (employee, address, phone_number, hire_date, position, sales_numbers, salary)
VALUES (‘Harry Wilson’, ‘222 3rd street’, 5553457777, '2018-01-10', ‘cashier’, 401, 42000);
INSERT INTO Employee_Information (employee, address, phone_number, hire_date, position, sales_numbers, salary)
VALUES (‘Sarah Adams’, ‘333 4th street’, 5555677654, '2019-03-15', ‘cashier’, 316, 36000);
INSERT INTO Employee_Information (employee, address, phone_number, hire_date, position, sales_numbers, salary)
VALUES (‘Alison Johnson’, ‘777 5th street’, 5559091111, '2017-11-01', ‘manager’, null, 60000);
ORA-00911用于插入的每一行.
ORA-00911 for every line of insertion.
推荐答案
尝试一下:(日期列,您需要将其转换为日期,并使用'字符而不是'和')
try this: (date column you need to convert it to date and use ' chars instead of ‘ and ’)
INSERT INTO Employee_Information (employee, address, phone_number,
hire_date, position, sales_numbers, salary)
VALUES ('John Smith', '123 1st street', 5554622919, to_date('2017-11-25','yyyy-mm-dd') , 'assistant manager', null, 55000);
INSERT INTO Employee_Information (employee, address, phone_number, hire_date, position, sales_numbers, salary)
VALUES ('Bob Goldman', '321 2nd street', 5553392454, to_date('2018-12-13','yyyy-mm-dd'), 'cashier', 345, 38000);
INSERT INTO Employee_Information (employee, address, phone_number, hire_date, position, sales_numbers, salary)
VALUES ('Harry Wilson', '222 3rd street', 5553457777, to_date('2018-01-10','yyyy-mm-dd'), 'cashier', 401, 42000);
INSERT INTO Employee_Information (employee, address, phone_number, hire_date, position, sales_numbers, salary)
VALUES ('Sarah Adams', '333 4th street', 5555677654, to_date('2019-03-15','yyyy-mm-dd'), 'cashier', 316, 36000);
INSERT INTO Employee_Information (employee, address, phone_number, hire_date, position, sales_numbers, salary)
VALUES ('Alison Johnson', '777 5th street', 5559091111, to_date('2017-11-01','yyyy-mm-dd'), 'manager', null, 60000);
这篇关于SQL-ORA-00911-尝试插入记录时出现无效字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文