我正在根据旧表“预订”创建一个新表“old_booking”,并将“dateTo”行从旧表插入到新表中。
我不断收到 sqlplus cmd 行中的错误
ORA-01400: cannot insert NULL into ("SYSTEM", "OLDBOOKING", HOTELNO")
为什么会这样,我该如何解决?
CREATE TABLE Booking
(hotelNo CHAR(8) NOT NULL
,guestNo CHAR (8) NOT NULL
,dateFrom DATE
,dateTo DATE
,CONSTRAINT FkhotelNo2 FOREIGN KEY (hotelNo) REFERENCES Hotel(hotelNo)
,CONSTRAINT FkguestNo FOREIGN KEY (guestNo) REFERENCES Guest (guestNo)
);
CREATE TABLE Old_Booking
(hotelNo CHAR(8) NOT NULL
,guestNo CHAR (8) NOT NULL
,dateFrom DATE
,dateTo DATE
);
INSERT INTO oldBooking(dateTo)
SELECT dateTo FROM Booking;