create procedure "cmstst".getworkday(pfirstdate varchar(10),penddate varchar(10))
returning varchar(10);
define pdaycounts varchar(10);
select distinct(
(select days from cal_date where dates=penddate) -
(select days from cal_date where dates=pfirstdate)-
(select count(*) from cal_date where dates >=pfirstdate
and dates <=penddate and status='H')
) into pdaycounts
from cal_date
where status='W';
return pdaycounts ;
end procedure
create procedure "informix".getdwpaysum(pSerialNo varchar(40),pPayment varchar(32)) //传参进来 | |
|
|
returning decimal;//返回值类型 |
|
|
|
define pBalance decimal;//返回值参数 |
|
|
|
|
|
|
|
select nvl(sum(paysum),0) as paysum into pBalance | |
|
|
from DUEBILL_WASTEBOOK |
|
|
|
where Objectno=pSerialNo |
|
|
|
and Payment = pPayment; |
|
|
|
return pBalance; |
|
|
|
end procedure |
|
然后在写sql语句的时候直接就可以调用了!!!