当前位置:网站首页>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 中间加逗号

数据就成功查出来了!!!!!!!!!!!!!
边栏推荐
- 6.26CF模拟赛B:数组缩减题解
- 整理混乱的头文件,我用include what you use
- 基于C语言的菜鸟驿站管理系统
- ThreadLocal原理与使用
- [go ~ 0 to 1] read, write and create files on the sixth day
- 自由小兵儿
- Detailed explanation of issues related to SSL certificate renewal
- 2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import 'fmt' func
- Is the securities account opened by qiniu safe?
- LeetCode FizzBuzz C#解答
猜你喜欢
随机推荐
How is the entered query SQL statement executed?
Is the securities account opened by qiniu safe?
node_exporter部署
Process of manually encrypt the mass-producing firmware and programming ESP devices
Scala basic tutorial -- 20 -- akka
Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
Scala basic tutorial -- 18 -- set (2)
What if the self incrementing ID of online MySQL is exhausted?
正则替换【JS,正则表达式】
性能优化之关键渲染路径
2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import 'fmt' func
整理混乱的头文件,我用include what you use
One question per day (2022-07-02) - Minimum refueling times
26. 删除有序数组中的重复项 C#解答
物联网应用技术的就业前景和现状
[opencv introduction to mastery 9] opencv video capture, image and video conversion
Download the first Tencent technology open day course essence!
神经网络物联网是什么意思通俗的解释
ESP32-C3入门教程 问题篇⑫——undefined reference to rom_temp_to_power, in function phy_get_romfunc_addr








