dbms_output.putline的输出在哪里?

balladist 2004-09-14 11:26:09
我用c#调用自己的存储过程,dbms_output.putline地输出在哪里可以看到?或者能否重定向输出到某个文件或者log日志?
...全文
2300 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
dinya2003 2004-09-15
  • 打赏
  • 举报
回复
在C#里面要看到输出结果,请将在过程的参数中加一个输出参数, procedure(... ,p_out out varchar2) as... 这样在C#调用过程的时候制定一个输出值.然后就可以通过执行过程来看到输出的数据.

当然你可以在过程中把输出的数据记录在文件中或记录在日志表中./
leborety 2004-09-15
  • 打赏
  • 举报
回复
dbms_output.putline 在外部没用吧,学习
bzszp 2004-09-15
  • 打赏
  • 举报
回复
输出到文件的话
用utl_file来控制
wupangzi 2004-09-15
  • 打赏
  • 举报
回复
外部调用还没用过!
学习!
mdxk 2004-09-15
  • 打赏
  • 举报
回复
先修改或添加init.ora的UTL_FILE_DIR参数
例如:
utl_file_dir=G:\oracle\temp

declare
file_handle UTL_FILE.FILE_TYPE;
begin
file_handle := UTL_FILE.FOPEN('/tmp', '文件名', 'w');
UTL_FILE.PUTF(file_handle, '写入的信息\n');
UTL_FILE.FCLOSE(file_handle);
Exception
WHEN utl_file.invalid_path THEN
raise_application_error(-20000, 'ERROR: Invalid path for file or path not in INIT.ORA.');
end;
PutF()过程用来以指定格式把文本写入一个文件
Put_Line()过程把一个指定的字符串写入文件并在文件中开始新的一行
baojianjun 2004-09-15
  • 打赏
  • 举报
回复
用utl_file
balladist 2004-09-15
  • 打赏
  • 举报
回复
我现在就是按楼上这样做的,但是太麻烦啦,影响代码。我想问的是,怎么把输出记录到文件中呢?
C# 访问Oracle示例+PL/SQL+存储过程+触发器 完整示例 测试可用 --PL/SQL基础1 declare begin dbms_output.('不输出不换行'); dbms_output.put_line('输出并换行'); end; --PL/SQL基础2 declare dig number(20,2); begin select avg(price) into dig from products; dbms_output.put_line('电子产品的平均价格是'||dig); end; --PL/SQL基础3 根据产品编号获得产品对象 --pname products.name%type; pname变量的类型与products.name列的类型一样 declare pid constant products.id%type:=1; --定义常量,初值1 pname products.name%type; pdate products.adddate%type; begin --pid:=1; select name,adddate into pname,pdate from products where id=pid; dbms_output.put_line('产品名称是:'||pname||',日期'||pdate); end; --PL/SQL基础4 根据产品编号获得产品对象 --obj products%rowtype; obj与products表的单行类型一样,可以通过点运算取值obj.price declare obj products%rowtype; begin select * into obj from products where id=&编号; dbms_output.put_line('产品名称是:'||obj.name||',价格:'||obj.price); end; --PL/SQL基础5 条件if declare vid products.id%type; vprice products.price%type; begin vid:=&编号; select price into vprice from products where id=vid; if vprice100 and vprice<=1000 then dbms_output.put_line('价格在100—1000之间'); else dbms_output.put_line('价格在1000以上'); end if; end; --PL/SQL基础5 多条件case begin case '&等级' when 'A' then dbms_output.put_line('优秀'); when 'B' then dbms_output.put_line('合格'); when 'C' then dbms_output.put_line('不合格'); end case; end; select id, name, typeid, price, adddate from products create table students( Id int primary key, sex int ) insert into students select 1,1 from dual union select 2,0 from dual union select 3,1 from dual union select 4,0 from dual union select 5,1 from dual insert into students(Id) values(6) select * from students; select translate(translate('1心1意 3心2意','1','一'),'3','三') from dual; select id,nvl(translate(translate(sex,1,'女'),0,'男'),'未知') from students; select id,case as 性别 from( sele

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧