当前位置:网站首页>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) - 网页数据解析(2) | BeautifulSoup4在爬虫中的使用
- Technology sharing | interface testing value and system
- Scala basic tutorial -- 14 -- implicit conversion
- 模板_判断素数_开方 / 六素数法
- .NET ORM框架HiSql实战-第二章-使用Hisql实现菜单管理(增删改查)
- 学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
- 2014 Hefei 31st youth informatics Olympic Games (primary school group) test questions
- 关于判断点是否位于轮廓内的一点思考
- Scala基础教程--18--集合(二)
- 性能优化之关键渲染路径
猜你喜欢
英特尔集成光电研究最新进展推动共封装光学和光互连技术进步
Scala basic tutorial -- 19 -- actor
[uniapp] uniapp development app online Preview PDF file
Li Kou brush question diary /day2/2022.6.24
千万不要只学 Oracle、MySQL!
Deleting nodes in binary search tree
The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology
Mxnet implementation of googlenet (parallel connection network)
Scala基础教程--18--集合(二)
学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
随机推荐
使用canal配合rocketmq监听mysql的binlog日志
2022 ByteDance daily practice experience (Tiktok)
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
Caché WebSocket
Bi skills - permission axis
Scala basic tutorial -- 20 -- akka
Lex and yacc based lexical analyzer + parser
Li Kou brush question diary /day2/2022.6.24
其他InterSystems %Net工具
redis分布式锁的8大坑总结梳理
技术分享 | 接口测试价值与体系
One question per day (2022-07-02) - Minimum refueling times
Uni app and uviewui realize the imitation of Xiaomi mall app (with source code)
Technology sharing | interface testing value and system
Scala基础教程--17--集合
1672. 最富有客户的资产总量
[go ~ 0 to 1] read, write and create files on the sixth day
问下各位大佬有用过cdc直接mysql to clickhouse的么
26. Delete the duplicate item C solution in the ordered array
What if the self incrementing ID of online MySQL is exhausted?