为什么我不断收到此错误消息
ORA-00928:缺少SELECT关键字
这是我的查询...
INSERT ALL
INTO ACADEMIC_SESSION (SESSIONID, SESSIONNAME) VALUES (200, 'FALL SESSION'),
INTO ACADEMIC_SESSION (SESSIONID, SESSIONNAME) VALUES (300, 'SUMMER SESSION')
SELECT * from DUAL;
我看不出有什么问题。
答案 0 :(得分:1)
,
语句之间没有逗号INTO
INSERT ALL
INTO ACADEMIC_SESSION (SESSIONID, SESSIONNAME) VALUES (200, 'FALL SESSION')
INTO ACADEMIC_SESSION (SESSIONID, SESSIONNAME) VALUES (300, 'SUMMER SESSION')
SELECT * from DUAL;
答案 1 :(得分:1)
语法错误;使用以下之一:
SQL> create table academic_session
2 (session_id number,
3 session_name varchar2(20));
Table created.
SQL> insert into academic_session (session_id, session_name)
2 select 200, 'fall session' from dual union all
3 select 300, 'summer session' from dual;
2 rows created.
SQL> insert all
2 into academic_session (session_id, session_name)
3 values (400, 'spring session')
4 into academic_session (session_id, session_name)
5 values (500, 'winter session')
6 select * from dual;
2 rows created.
SQL>
答案 2 :(得分:0)
如果您需要在表中插入两行,则可以这样:
INSERT INTO ACADEMIC_SESSION (SESSIONID, SESSIONNAME)
VALUES (200, 'FALL SESSION'), (300, 'SUMMER SESSION');
希望这会有所帮助。