pb呼叫oracle中的儲存過程

2021-05-24 05:54:51 字數 2472 閱讀 9642

1、現在oracle中建立乙個儲存過程:

create or replace procedure proc_jbylbxqk(as_ny in string) is

ll_tczz number(12);

ll_tctx number(12);

ll_dbzz number(12);

ll_dbtx number(12);

ll_zzxj number(12);

ll_txxj number(12);

ll_zj number(12);

ll_lhjy number(12);

ll_num number(12);

begin

select nvl(sum(decode(insr_detail_code,'2',decode(pers_type,'1',row_pers,0),0)),0),

nvl(sum(decode(insr_detail_code,'2',decode(pers_type,'2',row_pers,0),0)),0),

0,0,

nvl(sum(decode(insr_detail_code,'2',decode(pers_type,'1',row_pers,0),0)),0) + 0,

nvl(sum(decode(insr_detail_code,'2',decode(pers_type,'2',row_pers,0),0)),0) + 0,

nvl(sum(decode(insr_detail_code,'2',decode(pers_type,'1',row_pers,0),0)),0) + nvl(sum(decode(insr_detail_code,'2',decode(pers_type,'2',row_pers,0),0)),0) + 0 + 0,

nvl(sum(decode(insr_detail_code,'2',decode(corp_type_code,40,row_pers,0),0)),0) + nvl(sum(decode(insr_detail_code,'2',decode(corp_type_code,50,row_pers,0),0)),0) + nvl(sum(decode(insr_detail_code,'2',decode(corp_type_code,60,row_pers,0),0)),0)

into ll_tczz,ll_tctx,ll_dbzz,ll_dbtx,ll_zzxj,ll_txxj,ll_zj,ll_lhjy

from

(select count(*) as row_pers,b.pers_type as pers_type,a.insr_detail_code as insr_detail_code,d.corp_type_code as corp_type_code

from bs_pres_insur a, bs_insured b,bs_corp_pres t,bs_corp d

where a.indi_id = b.indi_id and to_char(begin_date,'yyyy-mm') <= as_ny and indi_join_sta = '1'

and t.corp_id = d.corp_id and b.indi_id = t.indi_id

group by b.pers_type,a.insr_detail_code,d.corp_type_code);

begin

select count(*) into ll_num from rpt_jbylbxqk where tjny = as_ny;

if ll_num = 0 then

insert into rpt_jbylbxqk (tczz,tctx,dbzz,dbtx,zzxj,txxj,zj,lhjy,tjny,tjsj)

values (ll_tczz,ll_tctx,ll_dbzz,ll_dbtx,ll_zzxj,ll_txxj,ll_zj,ll_lhjy,as_ny,sysdate);

else

delete from rpt_jbylbxqk where tjny = as_ny;

insert into rpt_jbylbxqk (tczz,tctx,dbzz,dbtx,zzxj,txxj,zj,lhjy,tjny,tjsj)

values (ll_tczz,ll_tctx,ll_dbzz,ll_dbtx,ll_zzxj,ll_txxj,ll_zj,ll_lhjy,as_ny,sysdate);

end if;

commit;

exception when others then

rollback;

end;

end proc_jbylbxqk;

2、在pb中宣告宣告乙個函式wf_proc_ylbxybb,函式**如下:

declare p_tj procedure for proc_jbylbxqk (:as_ny) using sqlca;

execute p_tj;

3、在適當的地方呼叫這個函式即可。

pb如何呼叫儲存過程

create or replace procedure testadd id in number,name in varchar2 is begin insert into leadtest id,name values id,name end testadd long lngid string s...

在asp中呼叫sql server的儲存過程

在asp中呼叫sql server的儲存過程可以加快程式執行速度,所以這些天在研究asp中利用sql server的儲存過程,現總結如下,其中很多思想也是直接從chinaasp論壇中得出來,希望能給大家一些幫助。1.呼叫儲存過程的一般方法 先假設在sql server中有一儲存過程dt users ...

在asp中呼叫sql server的儲存過程方法

在asp中呼叫sql server的儲存過程可以加快程式執行速度 1.呼叫儲存過程的一般方法 先假設在sql server中有一儲存過程dt users create procedure dbo dt users asselect from users return go第一種方法是不利用comma...