--查询上一月,下一月时+1
SELECT
pid,amount,unit,ntype
from income.jk_bank_analyze
WHERE
ndate=add_months(to_date('2012-4-1','yyyy-MM-dd'),-1) and unit='HSP' and ntype=15
select add_months(sysdate,-1) from dual;
--查询上一日,下一日时+1
select
nvl(sum(t.amount),0) into shangri1
from income.jk_bank_dynamics_tmp t
where t.ntype=1 and t.unit=in_unit and
t.ndate=to_date(in_date,'yyyy-MM-dd')-1
--过滤重复数据