我尝试运行此SQL语句时出错

时间:2016-12-11 13:15:28

标签: sql oracle

我正在运行这段代码但是每行都会收到此错误。

从命令行的第140行开始出错 - INSERT INTO Delivery_tbl(Deliver_ID,Delivery_Address,Delivery_HouseNo,Delivery_date_time)VALUES(' D0321',' SA3 4JK',' 74',TO_DATE(' 11 -10-2016',' 09:12:21')) 命令行错误:140列:39 错误报告 - SQL错误:ORA-00904:" DELIVERY_ADDRESS":无效的标识符 00904. 00000 - "%s:无效标识符" *原因:
*操作:

 CREATE TABLE Delivery_tbl (

 Delivery_ID varchar2(5),
  Delivery_Postcode varchar2 (10),
  Delivery_HouseNo varchar2 (10),
  Delivery_date_time date ,

   PRIMARY KEY (Delivery_ID)
   );
 INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo,   Delivery_date_time) VALUES ('D0789', 'GL3 2QU', '8', TO_DATE('20-02-2016', '13:12:35'));
 INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0456' 'GL3 2HO', '21', TO_DATE ('28-02-2016', '16:51:32'));
 INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0123', 'BH8 6UG', '420', TO_DATE ('28-11-2016', '11:15:02'));
 INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0987', 'HI8 9BH', '54', TO_DATE ('20-04-2016', '12:05:54'));
 INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0654', 'DU7 3DF', '63', TO_DATE ('22-05-2016', '10:45:12'));
  INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0321', 'SA3 4JK', '74 ',TO_DATE ('11-10-2016', '09:12:21'));
   INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0741', 'BH8 8GH', ' 14 ', TO_DATE ('22-03-2016', '15:56:01'));
   INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0851', 'BH8 8AS', '56', TO_DATE ('15-07-2016', '18:02:45'));
INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0963', 'GL51 2AS', '105', TO_DATE ('08-01-2016', '17:14:41'));
INSERT INTO Delivery_tbl (Deliver_ID, Delivery_Address, Delivery_HouseNo, Delivery_date_time) VALUES ( 'D0753', 'GH5 3TU', '12', TO_DATE ('16-09-2016', '14:15:52'));

2 个答案:

答案 0 :(得分:2)

您创建的表没有delivery_address列,但您正在尝试插入该列。首先将列添加到create table语句中。

答案 1 :(得分:0)

表格中没有名称为delivery_address的列

创建或替换TABLE Delivery_tbl(

Delivery_ID varchar2(5),   Delivery_address varchar2(10),   Delivery_HouseNo varchar2(10),   Delivery_date_time日期,

PRIMARY KEY(Delivery_ID)    );