在winform应用程序中使用PLSQL dbms_output.put_line输出

时间:2014-06-08 12:03:51

标签: c# winforms plsql

我在PLSQL中有一个程序:

CREATE OR REPLACE PROCEDURE printAllPeople (payment INTEGER)
IS
  sum_ number(6) := payment;
  name_ varchar(10);
  CURSOR listOfPeople IS
  select lastname
  from driver join
  (select driver.id as tempdid, sum(payment) as isum
  from report join driver
  on report.driverid = driver.id
  group by driver.id
  having  sum(payment) > sum_)
  on driver.id = tempdid;
BEGIN
  IF NOT listOfPeople%ISOPEN THEN
 OPEN listOfPeople;
  END IF;
  LOOP
 FETCH listOfPeople INTO name_;
 EXIT WHEN listOfPeople%NOTFOUND;
     dbms_output.put_line(name_);
 END LOOP;
END;

我有一个winform应用程序,可以从Oracle DB中检索数据。 是否有任何选项以某种方式使用" dbms_output.put_line"在我的winform应用程序上显示输出?

1 个答案:

答案 0 :(得分:0)

想象一下,简单地调用这样的函数:

CREATE OR REPLACE
FUNCTION get_dbms_output(maxbytes IN NUMBER, buffer OUT VARCHAR2) RETURN NUMBER
IS
    l_line VARCHAR2(255);
    l_done NUMBER := 0;
BEGIN
    LOOP
        EXIT WHEN LENGTH(buffer) + 255 > maxbytes OR l_done = 1;
        dbms_output.get_line(l_line, l_done);
        buffer := buffer || l_line || CHR(10);
    END LOOP;
    RETURN l_done;
END get_dbms_output;
/