当前位置:网站首页>Oracle with as ORA-00903: invalid table name 多表报错
Oracle with as ORA-00903: invalid table name 多表报错
2022-07-04 17:47:00 【kjshuan】
今天遇到了一个问题 with as 多次使用会报错!!
网上查了资料好多都不行!
order是保留字,如果不小心用了order这个单词就只能加上双引号 "order" 操作
题目 是这个


第一次我尝试单表使用with as 正常运行!!
with sss as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid=01)
2 select * from sss
3 ;CNAME ABCD SID
---------- ---------- ----------
数学 02 01
语文 01 01
英语 03 01
with t as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid!=01)
2 select * from t;CNAME ABCD SID
---------- ---------- ----------
英语 03 02
数学 02 02
语文 01 02
体育 04 03
英语 03 03
数学 02 03
语文 01 03
体育 04 04
英语 03 04
体育 04 04
语文 01 04CNAME ABCD SID
---------- ---------- ----------
数学 02 05
英语 03 05
英语 03 06
语文 01 06
体育 04 07
数学 02 07
英语 03 07
但我想要 2表联查时 出现以下错误
with sss as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid=01),
with t as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid!=01)
2 3 select * from t,sss;
with t as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid!=01)
*
ERROR at line 2:
ORA-00903: invalid table name

翻译很清楚 无效的表名 !!(表名明明是对的怎么就无效了????)
后来发现多了个 wtih 去掉之后成功
SQL> ;
1 with sss as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid=01),
2 with t as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid!=01)
3* select * from t,sss
with sss as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid=01),
t as (select cc.cname,cc.cid abcd,ss.sid from course cc,sc scc,student ss where cc.cid=scc.cid and scc.sid=ss.sid and ss.sid!=01)
2 3 select * from t,sss;
CNAME ABCD SID CNAME ABCD SID
---------- ---------- ---------- ---------- ---------- ----------
英语 03 02 语文 01 01
英语 03 02 数学 02 01
注意点1 多表 with as 去掉后面的

注意点2 多表 with as 中间加逗号

数据就成功查出来了!!!!!!!!!!!!!
边栏推荐
- Nature microbiology | viral genomes in six deep-sea sediments that can infect Archaea asgardii
- My colleagues quietly told me that flying Book notification can still play like this
- 资料下载 丨首届腾讯技术开放日课程精华!
- 工厂从自动化到数字孪生,图扑能干什么?
- Deleting nodes in binary search tree
- 其他InterSystems %Net工具
- A method of using tree LSTM reinforcement learning for connection sequence selection
- Cache é JSON uses JSON adapters
- Li Kou brush question diary /day2/2022.6.24
- Scala basic tutorial -- 20 -- akka
猜你喜欢
随机推荐
Li Kou brush question diary /day2/2022.6.24
Caché WebSocket
Scala基础教程--17--集合
更安全、更智能、更精致,长安Lumin完虐宏光MINI EV?
Using SSH
[opencv introduction to mastery 9] opencv video capture, image and video conversion
IBM WebSphere MQ检索邮件
Perfect JS event delegation
1672. 最富有客户的资产总量
基于NCF的多模块协同实例
神经网络物联网平台搭建(物联网平台搭建实战教程)
从实时应用角度谈通信总线仲裁机制和网络流控
2022 ByteDance daily practice experience (Tiktok)
LM10丨余弦波动顺势网格策略
6.26CF模拟赛E:价格最大化题解
ftp、sftp文件传输
Unity给自己的脚本添加类似编辑器扩展的功能案例ContextMenu的使用
2022年字节跳动日常实习面经(抖音)
使用canal配合rocketmq监听mysql的binlog日志
Nature microbiology | viral genomes in six deep-sea sediments that can infect Archaea asgardii


![[uniapp] uniapp development app online Preview PDF file](/img/11/d640338c626249057f7ad616b55c4f.png)





