如何在我的网页中获取plsql out变量

时间:2014-12-29 08:36:44

标签: sql oracle

我有一个plSQL程序,它将吞吐量作为输出(吞吐量是我程序中的输出变量)   我想在我的网页上显示该输出          任何人都可以告诉我这个方法

create or replace
PROCEDURE pmonit(through1 OUT NUMBER )
AS
  ts1 TIMESTAMP;
  ts2 TIMESTAMP;
 pickid           NUMBER(30);
  no_of_picks  NUMBER(30);
  diff        NUMBER(30);
  rslt      number(30);
  cnt     number(30);
  cnt1     number(30);
  cntc number(30);
BEGIN
  rslt        :=0;
  cnt1       :=0;
  diff       :=0;
  no_of_picks:=0;
  cnt:=0;
  pickid :=0;
  no_of_picks :=0;
  cntc :=0;


  SELECT COUNT(*) INTO no_of_picks FROM prov_adapter_pmonitor;
  select pick_id into pickid from prov_adapter_pmonitor where pick_start_time='24-DEC-14 10.32.48.094000000 AM';
  no_of_picks := no_of_picks + pickid;
  WHILE pickid < no_of_picks
loop
    select count into cntc from prov_adapter_pmonitor where pick_id=pickid;
    if(cntc>0) then
    SELECT pick_start_time
     INTO ts1
     FROM prov_adapter_pmonitor
     WHERE pick_id=pickid    ;

    SELECT pick_start_time
     INTO ts2
     FROM prov_adapter_pmonitor
     WHERE pick_id=pickid+1;
    select sum(
     (extract(hour from ts2)-extract(hour from ts1))*3600+
     (extract(minute from ts2)-extract(minute from ts1))*60+
     extract(second from ts2)-extract(second from ts1))*1000 ms into diff from prov_adapter_pmonitor where
       pick_id=pickid;

    select count into cnt from prov_adapter_pmonitor where pick_id=pickid;
    rslt := rslt+diff;
    cnt1 :=cnt1+cnt;
    pickid  :=pickid       +1;
   else 
   pickid :=pickid +1;
   end if;
end loop;
if(rslt<=0)then 
through1:=0;
 dbms_output.put_line(through1);
else
through1 := cnt1/(rslt/(1000*60)); 
 dbms_output.put_line(through1);
 end if;
EXCEPTION
WHEN OTHERS THEN
 dbms_output.put_line(through1);
end;

1 个答案:

答案 0 :(得分:0)

在查询中运行该函数。

您似乎正在使用oracle。 我认为查询是这样的。

select pmonit() from dual;