如何获取C#中的PL-SQL块返回的dbms.output值 [英] How to get the dbms.output value returned by a PL-SQL block in C#

查看:200
本文介绍了如何获取C#中的PL-SQL块返回的dbms.output值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用System.Data.OrcaleClient在c#中执行PL-SQL块. 在Oracle中执行PL-SQL块时,将使用dbms.ouput打印结果.

I am trying to execute a PL-SQL block in c# using System.Data.OrcaleClient. The PL-SQL block when executed in oracle, prints the result using dbms.ouput.

我想在我的C#代码中得到"dbms.ouput"结果.

I want to get that "dbms.ouput" result in my C# code.

请帮助.

推荐答案

尝试使用dbms_output包的get_line功能.您可以创建一个过程以返回输出.像这样(只是一个例子):

Try to use get_line function of dbms_output package. You can create a procedure to return the output. Something like this (just a example):

procedure call_with_output(p_output out varchar2) is
  vret integer := 0;
  vtxt varchar2(4000);
begin
  dbms_output.enable;
  -- here call code that generate lines
  -- use the loop to retrieve info
  while vret = 0 loop
    dbms_output.get_line(vtxt, vret);
    if vret = 0 then
      if p_output  is null then
        p_output := vtxt;
      else
       p_output := p_output || chr(10) || vtxt;
      end if;
    end if;
  end loop;
  dbms_output.disable;
end;

这篇关于如何获取C#中的PL-SQL块返回的dbms.output值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆