SQL-ORA-00911-尝试插入记录时字符无效

问题描述 投票:0回答:1

Oracle Live SQL。我正在尝试为表插入记录。该表通过得很好,但是在每行记录中,我显然输入了一些无效字符。当然,这是一个非常模糊的错误。我不知道怎么了。

我尝试过更改日期值,尝试单独删除值,但是无论遇到什么错误,都可以。

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用于每一行插入。

sql insert character line
1个回答
0
投票

尝试一下:(日期列,您需要将其转换为日期,并使用'字符代替'')]

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);
© www.soinside.com 2019 - 2024. All rights reserved.