-2

当我尝试使用 INSERT INTO 时,我在所有 3 条语句中都收到了一个缺少逗号的错误,并检查了多次,谢谢。

INSERT INTO staff 
(staff_id, staff_name, address, d_o_b, email, phone_number, salary, hire_date, job_role, nationality, over_time, bonus, caravan_park_id)
VALUES 
(1.NEXTVAL, 'Simon Gould', '17 Pearson Grove', '13/10/92', 'sjpdsg@happyholidays.net', 07817333245, '24000', '13/10/15', 'engineer', 'Portuguese', '10 hours', '£500', 1.nextval);
INSERT INTO staff 
(staff_id, staff_name, address, d_o_b, email, phone_number, salary, hire_date, job_role, nationality, over_time, bonus, caravan_park_id)
VALUES 
(2.NEXTVAL, 'Josh Dawkins', '28 Mulholland Drive', '12/09/82', 'jd1982@happyholidays.net', 07801123456, '15000', '02/05/11', 'engineer', 'English', '6 hours', '£300', 2.nextval);
INSERT INTO staff 
(staff_id, staff_name, address, d_o_b, email, phone_number, salary, hire_date, job_role, nationality, over_time, bonus, caravan_park_id)
VALUES
(3.NEXTVAL, 'Michelle Arazanguiz', '75 Newport Way', '21/03/90', 'ma_holidays@happyholidays.net', 07323456456, '16000', '05/11/08', 'tour guide', 'Spanish', '0 hours', '£0', 3.nextval);
4

1 回答 1

1

根据Oracle 文档,您的查询应该类似于:

INSERT INTO staff 
(staff_id, staff_name, address, d_o_b, email, phone_number, salary, hire_date, job_role, nationality, over_time, bonus, caravan_park_id)
VALUES 
(staff_id.NEXTVAL, 'Simon Gould', '17 Pearson Grove', '13/10/92', 'sjpdsg@happyholidays.net', 07817333245, '24000', '13/10/15', 'engineer', 'Portuguese', '10 hours', '£500', caravan_park_id.nextval);
INSERT INTO staff 
(staff_id, staff_name, address, d_o_b, email, phone_number, salary, hire_date, job_role, nationality, over_time, bonus, caravan_park_id)
VALUES 
(staff_id.NEXTVAL, 'Josh Dawkins', '28 Mulholland Drive', '12/09/82', 'jd1982@happyholidays.net', 07801123456, '15000', '02/05/11', 'engineer', 'English', '6 hours', '£300', caravan_park_id.nextval);
INSERT INTO staff 
(staff_id, staff_name, address, d_o_b, email, phone_number, salary, hire_date, job_role, nationality, over_time, bonus, caravan_park_id)
VALUES
(staff_id.NEXTVAL, 'Michelle Arazanguiz', '75 Newport Way', '21/03/90', 'ma_holidays@happyholidays.net', 07323456456, '16000', '05/11/08', 'tour guide', 'Spanish', '0 hours', '£0', caravan_park_id.nextval);

也就是说,使用staff_id.NEXTVALandcaravan_park_id.nextval表示您想要这两个序列中的下一个值。

于 2016-07-04T23:40:17.187 回答