我试图在下面的查询中插入另一个选择查询的resultSet我不知道我的错误在哪里..得到SQL错误:ORA-00936:缺少表达式 00936. 00000 - “缺少表达”
这里我试图插入一个不在Departments表中的记录66,77 ..
INSERT INTO departments(DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID,LOCATION_ID)
SELECT DEPARTMENT_ID,DEPARTMENT_NAME,MANAGER_ID,LOCATION_ID (select * from
(SELECT 66 as DEPARTMENT_ID,'Administration' as DEPARTMENT_NAME, 200 as MANAGER_ID, 1700 as LOCATION_ID from dual
Union all
SELECT 77 as DEPARTMENT_ID,'Marketing' as DEPARTMENT_NAME, 201 as MANAGER_ID, 1800 as LOCATION_ID from dual)
minus select * from departments
) from dual;
答案 0 :(得分:1)
这部分不会编译:
,LOCATION_ID (select *
这应该有效:
insert into departments(department_id, department_name, manager_id,location_id)
select 66,'Administration',200,1700 from dual
union all select 77,'Marketing' ,201,1800 from dual
minus select department_id, department_name, manager_id,location_id from departments