你可以试试 execute immediate v_sql into 的用法应该就报错了由于按你这种写法,无需返回结果,oracle应该是自己进行了优化,判断select子句不需要执行吧没做过测试,个人猜想
解决方案 »
- oracle 不同模式下
- 因工作需要要使用Oracle,烦请高手推荐几本优秀的Oracle入门书籍。本人有C++/MFC基础,对SQL略知一二。
- 能不能把oracle所有的表空间都放到裸设备上?
- 关于执行SQL语句的时间问题(初级)
- 有关oracle表里内容的插入另一个表!!!急用!!!!谢谢!!!!!
- OMS登陆问题
- 关于Oracle数据库和外部程序通讯的问题。
- 请问oracle中有没有象SQLServer中的自增字段
- 请教,在Oracle中的sql问题!
- 非常急!!请高手指教!关于如何解锁
- 查询表的所有信息和信息总数
- oracleasm无法通过Initializing the Oracle ASMLib driver: [FAILED]
begin
execute immediate('select 1/0 from dual');
end;
oracle不报错一般情况要select 后要有into的没有into字句就没有意思,但是跟踪一下sql执行发现sql可以正常解析
begin
execute immediate 'select 1/0 from dual';
end;call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 0 0 1Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: SYSElapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 16.03 16.03
********************************************************************************SQL ID: 360pfbbv2s5hg
Plan Hash: 1388734953
select 1/0
from
dual
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 0 0 0Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS (recursive depth: 1)Rows Row Source Operation
------- ---------------------------------------------------
0 FAST DUAL (cr=0 pr=0 pw=0 time=0 us cost=2 size=0 card=1)发现Fetch 为0,猜测除数为0的错误应该在fetch报出来的
但是
begin
execute immediate('select a from dual');
end;
又是报错的,这个时候fetch也是0吗? 对于执行计划不太懂