0
CREATE TABLE dw.D_DAYLIGHT_SAVINGS
(
   DAYLIGHT_YEAR       INTEGER NOT NULL,
   DAYLIGHT_START      DATE,
   DAYLIGHT_END        DATE,
   Last_Udpated_date   DATE DEFAULT SYSDATE,
   Last_updated_user   VARCHAR2 (25) DEFAULT 'DW'
);

表已创建,但是当我尝试在 TOAD 中运行并在其中插入值时,会弹出错误,因为命令未正确结束。插入查询如下

insert into dw.D_DAYLIGHT_SAVINGS values 
(2013,'March 10','November 3'),
(2014,'March 9','November 2'),
(2015,'March 8','November 1'),
(2016,'March 13','November 6'),
(2017,'March 12','November 5');
4

1 回答 1

0

您必须INSERT INTO为每一行添加一个单独的语句,并DEFAULT为您未指定的每一列添加:

insert into dw.D_DAYLIGHT_SAVINGS values (2013,'March 10','November 3', DEFAULT, DEFAULT);
insert into dw.D_DAYLIGHT_SAVINGS values (2014,'March 9','November 2', DEFAULT, DEFAULT);
insert into dw.D_DAYLIGHT_SAVINGS values (2015,'March 8','November 1', DEFAULT, DEFAULT);
insert into dw.D_DAYLIGHT_SAVINGS values (2016,'March 13','November 6', DEFAULT, DEFAULT);
insert into dw.D_DAYLIGHT_SAVINGS values (2017,'March 12','November 5', DEFAULT, DEFAULT);

或提供应插入列的列列表:

insert into dw.D_DAYLIGHT_SAVINGS (DAYLIGHT_YEAR, DAYLIGHT_START, DAYLIGHT_END) values (2013,'March 10','November 3');
insert into dw.D_DAYLIGHT_SAVINGS (DAYLIGHT_YEAR, DAYLIGHT_START, DAYLIGHT_END) values (2014,'March 9','November 2');
insert into dw.D_DAYLIGHT_SAVINGS (DAYLIGHT_YEAR, DAYLIGHT_START, DAYLIGHT_END) values (2015,'March 8','November 1');
insert into dw.D_DAYLIGHT_SAVINGS (DAYLIGHT_YEAR, DAYLIGHT_START, DAYLIGHT_END) values (2016,'March 13','November 6');
insert into dw.D_DAYLIGHT_SAVINGS (DAYLIGHT_YEAR, DAYLIGHT_START, DAYLIGHT_END) values (2017,'March 12','November 5');
于 2013-11-14T18:16:45.463 回答