我试图通过加入 3 个表将值插入表中,但是我收到“ORA-00933:SQL 命令未正确结束”错误''
Posted
技术标签:
【中文标题】我试图通过加入 3 个表将值插入表中,但是我收到“ORA-00933:SQL 命令未正确结束”错误\'\'【英文标题】:I was trying to insert values into a table by joining 3 tables, however i am getting "ORA-00933: SQL command not properly ended" error''我试图通过加入 3 个表将值插入表中,但是我收到“ORA-00933:SQL 命令未正确结束”错误'' 【发布时间】:2020-04-08 18:09:11 【问题描述】:insert into emp_track values (emp_id,place)
select e.EMPLOYEE_ID, l.STATE_PROVINCE ||' '|| l.city as address
from employees e ,locations l,departments d
where l.location_id=d.location_id and d.department_id=e.department_id;
select 语句给出输出
EMPLOYEE_ID ADDRESS
100 Washington Seattle
103 Texas Southlake
120 California South San Francisco
【问题讨论】:
【参考方案1】:INSERT . . INTO
不会有 values
和 SELECT
语句,所以删除它:
insert into emp_track (emp_id,place)
select e.EMPLOYEE_ID, l.STATE_PROVINCE ||' '|| l.city as address
from employees e inner join
departments d
on d.department_id = e.department_id inner join
location l
on l.location_id = d.location_id;
注意:我使用了显式连接语法而不是逗号。
【讨论】:
@EricBrandt。 . .谢谢。以上是关于我试图通过加入 3 个表将值插入表中,但是我收到“ORA-00933:SQL 命令未正确结束”错误''的主要内容,如果未能解决你的问题,请参考以下文章