日期:2014-05-17  浏览次数:21689 次

oracle存储过程中如何输出变量的值?
oracle存储过程中如何输出变量的值?
我写的一个存储过程老是出错,我想看看其中几个变量的值,怎么看?
谢谢!

------解决方案--------------------
first:
set serveroutput on

second:
in the procedure ,add the pl/sql statement:

dbms_output.put_line(variable name)

------解决方案--------------------
dbms_output.put_line('fdafdsafdsa');
------解决方案--------------------
存储过程test的时候 set serveroutput on 是没用的吧?
在test的时候,有个dbms的tab页是用来接收dbms的输出的



探讨
first:
set serveroutput on

second:
in the procedure ,add the pl/sql statement:

dbms_output.put_line(variable name)

------解决方案--------------------
会直接在下面输出
探讨

写完了以后,结果会显示在哪里?在哪里去看写出来的值?

------解决方案--------------------
before creating the procedure,execute:
set serveroutput on 
in the sqlplus



------解决方案--------------------
异常时还没有执行到输出语句,所以没有看到结果
这个是查询语句无返回结果的错
------解决方案--------------------
单步调试呗
------解决方案--------------------
原因很清楚了,无返回值啊,毛病肯定出在select .. into ..这了,把into去了,把select放到sqlplus里执行下就0了
探讨
引用:
异常时还没有执行到输出语句,所以没有看到结果
这个是查询语句无返回结果的错
我本来是想通过看变量的值来查找存储过程出现异常的原因的。这下可好,也不知道是先有鸡还是先有鸡蛋了。

------解决方案--------------------
两种办法
1.dbms_output.put_line(变量);
2.设置个输出参数,将变量赋给这个输出参数。