联合查询不起作用,导致 ORA-00904 错误
我创建了两个表, uview 和 vview 。
CREATE TABLE Uview
( USERID CHAR(6) NOT NULL ENABLE,
pageID varCHAR2(50) NOT NULL ENABLE,
VISIT_TIME TIMESTAMP (6) NOT NULL ENABLE,
view_TIME TIMESTAMP (6) NOT NULL ENABLE,
fview_TIME TIMESTAMP (6) NOT NULL ENABLE,
entry varCHAR2(50) NOT NULL ENABLE,
exit varCHAR2(50) NOT NULL ENABLE,
PRIMARY KEY (USERID, VISIT_TIME,viewtime) ENABLE )
CREATE TABLE vview
( VISITORID CHAR(8) NOT NULL ENABLE,
pageID varCHAR2(50) NOT NULL ENABLE,
VISIT_TIME TIMESTAMP (6) NOT NULL ENABLE,
view_TIME TIMESTAMP (6) NOT NULL ENABLE,
fview_TIME TIMESTAMP (6) NOT NULL ENABLE,
entry varCHAR2(50) NOT NULL ENABLE,
exit varCHAR2(50) NOT NULL ENABLE,
PRIMARY KEY (visitorID, VISIT_TIME,view_time) ENABLE )
现在我想用 union 对这两个表进行查询。
select userID,pageID,visit_time,view_time,fview_time,exit,entry
from uview
union
select visitorid,pageID,visit_time,view_time,fview_time,exit,entry
from vview;
但是,出现 ORA-00904 错误:“ENTRY”:此标识符无效。 即使我从查询 ORA-00904:“退出”: 无效标识符结果中删除条目。这对我来说似乎很奇怪。请告诉我出了什么问题。谢谢 。
I have created two tables , uview and vview .
CREATE TABLE Uview
( USERID CHAR(6) NOT NULL ENABLE,
pageID varCHAR2(50) NOT NULL ENABLE,
VISIT_TIME TIMESTAMP (6) NOT NULL ENABLE,
view_TIME TIMESTAMP (6) NOT NULL ENABLE,
fview_TIME TIMESTAMP (6) NOT NULL ENABLE,
entry varCHAR2(50) NOT NULL ENABLE,
exit varCHAR2(50) NOT NULL ENABLE,
PRIMARY KEY (USERID, VISIT_TIME,viewtime) ENABLE )
CREATE TABLE vview
( VISITORID CHAR(8) NOT NULL ENABLE,
pageID varCHAR2(50) NOT NULL ENABLE,
VISIT_TIME TIMESTAMP (6) NOT NULL ENABLE,
view_TIME TIMESTAMP (6) NOT NULL ENABLE,
fview_TIME TIMESTAMP (6) NOT NULL ENABLE,
entry varCHAR2(50) NOT NULL ENABLE,
exit varCHAR2(50) NOT NULL ENABLE,
PRIMARY KEY (visitorID, VISIT_TIME,view_time) ENABLE )
Now I want to make a query of these two tables with union .
select userID,pageID,visit_time,view_time,fview_time,exit,entry
from uview
union
select visitorid,pageID,visit_time,view_time,fview_time,exit,entry
from vview;
However , there is an error of ORA-00904: "ENTRY": invalid identifier for this.
Even if i delete entry from the query ORA-00904: "Exit": invalid identifier results as well . This seems so odd to me . Please tell me what is wrong . Thanks .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Entry
是 Oracle 中的保留字:http://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm 。你必须用双引号将其转义:Entry
is a reserved word in Oracle: http://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm . You'll have to escape it with doublequotes: