17,377
社区成员
发帖
与我相关
我的任务
分享
create or replace procedure te(x in number) is
begin
if x>0 then
begin
x:=0-x;
end;
end if;
if x=0 then
begin
x:=1;
end;
end if;
end;
dbms_output.put_line(x);
end te;
/
CREATE OR REPLACE PROCEDURE "CARD"."TRANS"
(
mcht in varchar,
sett in varchar,
startcardno in varchar,
endcardno in varchar,
tx_code in varchar,
banlace in varchar,
startdate in varchar,
enddate in varchar,
traceno in varchar,
batchno in varchar,
termid in varchar,
document in varchar,
cardhold in varchar,
lxname in varchar,
telphone in varchar,
gkdate in varchar,
pagesize in number,
currpage in number,
recordcount out number
)
as
strsql varchar(1000);
begin
recordcount:=888;
strsql:='select count(*) from partranslog where merch_id=:mcht and sett_postdate>=to_char(:startdate) and sett_postdate<=to_char(:enddate)';
if length(startcardno)>0 and length(endcardno)>0 then
strsql:=strsql||' and cardno>=:startcartno and cardno<=:endcardno';
execute immediate strsql into recordcount using mcht,startdate,enddate,startcardno,endcardno,tx_code,banlace;
else
execute immediate strsql into recordcount using mcht,startdate,enddate;
end if;
update proce set name=recordcount;
end trans;
/
union
select DISTINCT TRAN_SLA_KEY,
TX_CODE,
cardno,
valid_date,
sett_postdate,
substr(TRAN_SLA_KEY,9,8),
input_mode,
merch_id,
REQ_TXNAMT,
integral,
trace_no,
sys_no,
orig_traceno,
rsp_code,
compl_flag,
TRANDATE,
substr(TRAN_SLA_KEY,17,5),
ADDIDATA1,
MER_ORDERNO,
REJ_CODE
from partranslog a where
((addidata1 like '%'||:PerName||'%') or (:PerName = 'Z'))
and ((addidata1 like '%'||:PerTel||'%') or (:PerTel = 'Z'))
and ((addidata1 like '%'||:PerDate||'%') or (:PerDate = 'Z'))
and ((mer_orderno = :XMLpkgDATABuf.cardholder) or (:XMLpkgDATABuf.cardholder = 'Z'))
/**** ((valid_date = :XMLpkgDATABuf.valid_date) or (:XMLpkgDATABuf.valid_date = 'Z')) delete by GuWei 20110704 *****/
and ((EXISTS(select * from merchant where a.MERCH_ID=MERCH_ID and EXISTS (select * from grppou where substr(merchant.GRP_NAME,1,8)=substr(MERGRP,1,8) and GRP_LEADER = :XMLpkgDATABuf.merch_id)) or (merch_id = :XMLpkgDATABuf.merch_id))
or (:XMLpkgDATABuf.merch_id = 'Z'))
and ((REQ_TXNAMT = :XMLpkgDATABuf.amount) or (:XMLpkgDATABuf.amount = 1000000000))
and ((term_id = :XMLpkgDATABuf.set_term) or (:XMLpkgDATABuf.set_term = 'Z'))
and ((trace_no = :XMLpkgDATABuf.trace_no) or (:XMLpkgDATABuf.trace_no = 'Z'))
and ((orig_traceno = :XMLpkgDATABuf.orig_traceno) or (:XMLpkgDATABuf.orig_traceno = 'Z'))
/*** and ((sys_no = :XMLpkgDATABuf.sys_no) or (:XMLpkgDATABuf.sys_no = 'Z')) delete by GuWei 20110704 ***/
and ((TRANDATE = :tmp_makedate) or (:tmp_makedate = 'Z'))
and ((substr(TRAN_SLA_KEY,17,5) = :XMLpkgDATABuf.instcode) or (:XMLpkgDATABuf.instcode = 'Z'))
and ((substr(TRAN_SLA_KEY,9,8) = :XMLpkgDATABuf.term_id) or (:XMLpkgDATABuf.term_id = 'Z'))
and ((BATCHID = :XMLpkgDATABuf.batchid) or (:XMLpkgDATABuf.batchid = 'Z'))
and (((substr(cardno,5,5) = :XMLpkgDATABuf.MerOnCode) or (:XMLpkgDATABuf.MerOnCode = 'Z')) or ((substr(addidata1,5,5) = :XMLpkgDATABuf.MerOnCode) or (:XMLpkgDATABuf.MerOnCode = 'Z')))
and ((merch_id = :XMLpkgDATABuf.Rev_Id) or (:XMLpkgDATABuf.Rev_Id = 'Z'))
and ((((SUBSTR(cardno,1,18) >= :XMLpkgDATABuf.startno) or (:XMLpkgDATABuf.startno = 'Z'))
and ((SUBSTR(cardno,1,18) <= :XMLpkgDATABuf.endno) or (:XMLpkgDATABuf.endno = 'Z')))
or (((SUBSTR(ADDIDATA1,1,18) <= :XMLpkgDATABuf.startno) and (SUBSTR(ADDIDATA1,20,18) >= :XMLpkgDATABuf.startno) or (:XMLpkgDATABuf.startno = 'Z'))
and ((SUBSTR(ADDIDATA1,1,18) <= :XMLpkgDATABuf.endno) and (SUBSTR(ADDIDATA1,20,18) >= :XMLpkgDATABuf.endno) or (:XMLpkgDATABuf.endno = 'Z'))))
and ((tx_code = :XMLpkgDATABuf.TxCode) or (:XMLpkgDATABuf.TxCode = 'Z'))
and ((sett_postdate >= to_char(:XMLpkgDATABuf.sett_postdate)))
and ((sett_postdate <= to_char(:XMLpkgDATABuf.tran_dt)))
maxrow=0;
EXEC SQL SELECT count(*) into :maxrow
FROM (select DISTINCT TRAN_SLA_KEY,
TX_CODE,
cardno,
valid_date,
sett_postdate,
substr(TRAN_SLA_KEY,9,8),
input_mode,
merch_id,
REQ_TXNAMT,
integral,
trace_no,
sys_no,
orig_traceno,
rsp_code,
compl_flag,
TRANDATE,
substr(TRAN_SLA_KEY,17,5),
ADDIDATA1,
MER_ORDERNO,
REJ_CODE
from translog a where
((addidata1 like '%'||:PerName||'%') or (:PerName = 'Z'))
and ((addidata1 like '%'||:PerTel||'%') or (:PerTel = 'Z'))
and ((addidata1 like '%'||:PerDate||'%') or (:PerDate = 'Z'))
and ((mer_orderno = :XMLpkgDATABuf.cardholder) or (:XMLpkgDATABuf.cardholder = 'Z'))
/**** ((valid_date = :XMLpkgDATABuf.valid_date) or (:XMLpkgDATABuf.valid_date = 'Z')) delete by GuWei 20110704 *****/
and ((EXISTS(select * from merchant where a.MERCH_ID=MERCH_ID and EXISTS (select * from grppou where substr(merchant.GRP_NAME,1,8)=substr(MERGRP,1,8) and GRP_LEADER = :XMLpkgDATABuf.merch_id)) or (merch_id = :XMLpkgDATABuf.merch_id))
or (:XMLpkgDATABuf.merch_id = 'Z'))
and ((REQ_TXNAMT = :XMLpkgDATABuf.amount) or (:XMLpkgDATABuf.amount = 1000000000))
and ((term_id = :XMLpkgDATABuf.set_term) or (:XMLpkgDATABuf.set_term = 'Z'))
and ((trace_no = :XMLpkgDATABuf.trace_no) or (:XMLpkgDATABuf.trace_no = 'Z'))
and ((orig_traceno = :XMLpkgDATABuf.orig_traceno) or (:XMLpkgDATABuf.orig_traceno = 'Z'))
/*** and ((sys_no = :XMLpkgDATABuf.sys_no) or (:XMLpkgDATABuf.sys_no = 'Z')) delete by GuWei 20110704 ***/
and ((TRANDATE = :tmp_makedate) or (:tmp_makedate = 'Z'))
and ((substr(TRAN_SLA_KEY,17,5) = :XMLpkgDATABuf.instcode) or (:XMLpkgDATABuf.instcode = 'Z'))
and ((substr(TRAN_SLA_KEY,9,8) = :XMLpkgDATABuf.term_id) or (:XMLpkgDATABuf.term_id = 'Z'))
and ((BATCHID = :XMLpkgDATABuf.batchid) or (:XMLpkgDATABuf.batchid = 'Z'))
and (((substr(cardno,5,5) = :XMLpkgDATABuf.MerOnCode) or (:XMLpkgDATABuf.MerOnCode = 'Z')) or ((substr(addidata1,5,5) = :XMLpkgDATABuf.MerOnCode) or (:XMLpkgDATABuf.MerOnCode = 'Z')))
and ((merch_id = :XMLpkgDATABuf.Rev_Id) or (:XMLpkgDATABuf.Rev_Id = 'Z'))
and ((((SUBSTR(cardno,1,18) >= :XMLpkgDATABuf.startno) or (:XMLpkgDATABuf.startno = 'Z'))
and ((SUBSTR(cardno,1,18) <= :XMLpkgDATABuf.endno) or (:XMLpkgDATABuf.endno = 'Z')))
or (((SUBSTR(ADDIDATA1,1,18) <= :XMLpkgDATABuf.startno) and (SUBSTR(ADDIDATA1,20,18) >= :XMLpkgDATABuf.startno) or (:XMLpkgDATABuf.startno = 'Z'))
and ((SUBSTR(ADDIDATA1,1,18) <= :XMLpkgDATABuf.endno) and (SUBSTR(ADDIDATA1,20,18) >= :XMLpkgDATABuf.endno) or (:XMLpkgDATABuf.endno = 'Z'))))
and ((tx_code = :XMLpkgDATABuf.TxCode) or (:XMLpkgDATABuf.TxCode = 'Z'))
and ((sett_postdate >= to_char(:XMLpkgDATABuf.sett_postdate)))
and ((sett_postdate <= to_char(:XMLpkgDATABuf.tran_dt)))
create or replace procedure te(x in number) is
begin
if x>0 then
begin
x:=0-x;
end;
end if;
if x=0 then
begin
x:=1;
end;
end if;
dbms_output.put_line(x);
end te;
/