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

数据就成功查出来了!!!!!!!!!!!!!
边栏推荐
- 2022CoCa: Contrastive Captioners are Image-Text Fountion Models
- 信息学奥赛一本通 1336:【例3-1】找树根和孩子
- Wireshark网络抓包
- redis分布式锁的8大坑总结梳理
- 完善的js事件委托
- 2022养生展,健康展,北京大健康展,健康产业展11月举办
- Is Guoyuan futures a regular platform? Is it safe to open an account in Guoyuan futures?
- 【机器学习的数学基础】(一)线性代数(Linear Algebra)(上+)
- 与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用
- 【OpenCV入门到精通之九】OpenCV之视频截取、图片与视频互转
猜你喜欢

node_exporter部署

The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology

What if the self incrementing ID of online MySQL is exhausted?

Deleting nodes in binary search tree

每日一题(2022-07-02)——最低加油次数

BI技巧丨权限轴

Nebula Importer 数据导入实践

学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”

My colleagues quietly told me that flying Book notification can still play like this

更安全、更智能、更精致,长安Lumin完虐宏光MINI EV?
随机推荐
Scala基础教程--13--函数进阶
基于lex和yacc的词法分析器+语法分析器
ESP32-C3入门教程 问题篇⑫——undefined reference to rom_temp_to_power, in function phy_get_romfunc_addr
启牛开的证券账户安全吗?
[uniapp] uniapp development app online Preview PDF file
prometheus安装
IBM WebSphere MQ retrieving messages
C language printing exercise
性能优化之关键渲染路径
26. 删除有序数组中的重复项 C#解答
【OpenCV入门到精通之九】OpenCV之视频截取、图片与视频互转
The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology
基于C语言的菜鸟驿站管理系统
神经网络物联网平台搭建(物联网平台搭建实战教程)
Perfect JS event delegation
Caché JSON 使用JSON适配器
BI技巧丨权限轴
TorchDrug教程
使用SSH
自由小兵儿