[20241014]记录工作的一个错误--sql语句忘记写分号.txt --//记录工作的一个错误--sql语句忘记写分号.txt. 1.环境: SCOTT@book01p> @ver2 ============================== PORT_STRING : x86_64/Linux 2.4.xx VERSION : 21.0.0.0.0 BANNER : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production BANNER_FULL : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production Version 21.3.0.0.0 BANNER_LEGACY : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production CON_ID : 0 PL/SQL procedure successfully completed. 2.测试: $ cat a1.txt SELECT D.constraint_type as CONSTRAINT_TYPE, C.COLUMN_NAME, C.position, D.r_constraint_name, E.table_name as table_ref, f.column_name as column_ref, C.table_name FROM ALL_CONS_COLUMNS C inner join ALL_constraints D on D.OWNER = C.OWNER and D.constraint_name = C.constraint_name left join ALL_constraints E on E.OWNER = D.r_OWNER and E.constraint_name = D.r_constraint_name left join ALL_cons_columns F on F.OWNER = E.OWNER and F.constraint_name = E.constraint_name and F.position = c.position WHERE C.OWNER = 'SCOTT' and C.table_name = 'EMP' and D.constraint_type <> 'P' order by d.constraint_name, c.position --//sql语句忘记写最后的分号. SCOTT@book01p> @ a1.txt SCOTT@book01p> @ a1.txt SCOTT@book01p> @ a1.txt --//感觉已经执行完成。 SCOTT@book01p> @ dpc '' '' '' PLAN_TABLE_OUTPUT ------------------------------------- SQL_ID d675kjgr4d8p4, child number 0 ------------------------------------- select to_char(sysdate, 'YYYYMMDD-HH24MISS') seminar_logfile , instance_name||'-'||to_char(sysdate, 'YYYYMMDD-HH24MISS') tpt_tempfile from v$instance Plan hash value: 4175978637 ---------------------------------------------------------------------------- | Id | Operation | Name | E-Rows |E-Bytes| Cost (%CPU)| ---------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | | 1 (100)| | 1 | MERGE JOIN CARTESIAN | | 1 | 21 | 0 (0)| | 2 | MERGE JOIN CARTESIAN | | 1 | 10 | 0 (0)| | 3 | MERGE JOIN CARTESIAN| | 1 | | 0 (0)| | 4 | FIXED TABLE FULL | X$QUIESCE | 1 | | 0 (0)| | 5 | BUFFER SORT | | 1 | | 0 (0)| | 6 | FIXED TABLE FULL | X$KJIDT | 1 | | 0 (0)| | 7 | BUFFER SORT | | 1 | 10 | 0 (0)| |* 8 | FIXED TABLE FULL | X$KSUXSINST | 1 | 10 | 0 (0)| | 9 | BUFFER SORT | | 1 | 11 | 0 (0)| |* 10 | FIXED TABLE FULL | X$KVIT | 1 | 11 | 0 (0)| ---------------------------------------------------------------------------- Query Block Name / Object Alias (identified by operation id): ------------------------------------------------------------- 1 - SEL$AF73C875 4 - SEL$AF73C875 / "QU"@"SEL$5" 6 - SEL$AF73C875 / "X$KJIDT"@"SEL$5" 8 - SEL$AF73C875 / "KS"@"SEL$5" 10 - SEL$AF73C875 / "KV"@"SEL$5" Predicate Information (identified by operation id): --------------------------------------------------- 8 - filter((INTERNAL_FUNCTION("KS"."CON_ID") AND "KS"."INST_ID"=USERENV('INSTANCE'))) 10 - filter("KVITTAG"='kcbwst') Note ----- - Warning: basic plan statistics not available. These are only collected when: * hint 'gather_plan_statistics' is used for the statement or * parameter 'statistics_level' is set to 'ALL', at session or system level 46 rows selected. --//很明显执行内容来源tpt 的init.sql脚本。 --//当使用edit打开时,看到的情况: SELECT D.constraint_type as CONSTRAINT_TYPE, C.COLUMN_NAME, C.position, D.r_constraint_name, E.table_name as table_ref, f.column_name as column_ref, C.table_name FROM ALL_CONS_COLUMNS C inner join ALL_constraints D on D.OWNER = C.OWNER and D.constraint_name = C.constraint_name left join ALL_constraints E on E.OWNER = D.r_OWNER and E.constraint_name = D.r_constraint_name left join ALL_cons_columns F on F.OWNER = E.OWNER and F.constraint_name = E.constraint_name and F.position = c.position WHERE C.OWNER = 'SCOTT' and C.table_name = 'EMP' and D.constraint_type <> 'P' order by d.constraint_name, c.position / --//edit打开后自动在结尾加了/,在这里迷糊一下,感觉没有问题。保存后,要打入/才会执行。再次查看a1.txt文本才发现问题所在。 --//还有1个小技巧输入;可以看到前面执行的sql语句。 SCOTT@book01p> ; 1 SELECT D.constraint_type as CONSTRAINT_TYPE, C.COLUMN_NAME, C.position, D.r_constraint_name, 2 E.table_name as table_ref, f.column_name as column_ref, 3 C.table_name 4 FROM ALL_CONS_COLUMNS C 5 inner join ALL_constraints D on D.OWNER = C.OWNER and D.constraint_name = C.constraint_name 6 left join ALL_constraints E on E.OWNER = D.r_OWNER and E.constraint_name = D.r_constraint_name 7 left join ALL_cons_columns F on F.OWNER = E.OWNER and F.constraint_name = E.constraint_name and F.position = c.position 8 WHERE C.OWNER = 'SCOTT' 9 and C.table_name = 'EMP' 10 and D.constraint_type <> 'P' 11* order by d.constraint_name, c.position --//注:即使后面补了分号,打入;看到的内容没有后面的分号。
[20241014]记录工作的一个错误--sql语句忘记写分号.txt
来源:这里教程网
时间:2026-03-03 20:42:03
作者:
编辑推荐:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- 达梦数据库安装与配置
达梦数据库安装与配置
26-03-03 - 数据库管理-第248期 23ai:全球分布式数据库-分片数据分布方法(20241006)
- Oracle这款免费的代码平台,铁了心砸掉程序员饭碗!
Oracle这款免费的代码平台,铁了心砸掉程序员饭碗!
26-03-03 - 使用Oracle 19c,必须要注意这个Bug
使用Oracle 19c,必须要注意这个Bug
26-03-03 - 数据库管理-第249期 23ai:全球分布式数据库-请求路由与查询过程(20241008)
- 推荐几本学习Oracle初期阅读的书
推荐几本学习Oracle初期阅读的书
26-03-03 - oracle数据坏块处理(一)-通过rman备份修复
oracle数据坏块处理(一)-通过rman备份修复
26-03-03 - golden gate目录从standby端迁移到primary端
golden gate目录从standby端迁移到primary端
26-03-03 - Oracle数据恢复—异常断电导致Oracle数据库数据库打不开的数据恢复案例
- 数据库管理-第244期 一次无法switchover的故障处理(20240928)
