作业:在emp表中插入4行
Eid, name, did, hiredate, salary 1, jeff, 1, 2005-1-1, 70000 2, susan, 2, 2005-6-1, 50000 3, bob, 1, 2000-1-1, 90000 4, steve, 1, 2006-1-1, 60000
我的回答:
INSERT INTO EMP
VALUES ('1','JEFF','1','2005-01-01',70000);
INSERT INTO EMP
VALUES ('2','SUSAN','2','2005-06-01',50000);
INSERT INTO EMP
VALUES ('3','BOB','1','2000-01-01',90000);
INSERT INTO EMP
VALUES ('4','STEVE','1','2006-01-01',60000);
错误:
VALUES ('1','JEFF','1','2005-01-01',70000) * ERROR at line 2: ORA-01861: literal does not match format string VALUES ('2','SUSAN','2','2005-06-01',50000) * ERROR at line 2: ORA-01861: literal does not match format string VALUES ('3','BOB','1','2000-01-01',90000) * ERROR at line 2: ORA-01861: literal does not match format string VALUES ('4','STEVE','1','2006-01-01',60000) * ERROR at line 2: ORA-01861: literal does not match format string
答案 0 :(得分:0)
对于格式为YYYY-MM-DD的日期常量,请使用date
指示符:
INSERT INTO EMP
VALUES ('1', 'JEFF', '1', DATE '2005-01-01', 70000);
注意:如果第一列和第三列是数字,则不要使用单引号。