日期:2014-05-17  浏览次数:20699 次

求一存储过程(sqlserver转oracle)
CREATE         PROCEDURE   BCP_transaction_BillList
(
@Page_No nvarchar(10)   =   '1 ',
@Page_Size nvarchar(10)   =   '10 ',
@Record_Count bigint   =   0   output,
@TID nvarchar(60)   =   ' ',
@NO nvarchar(30)   =   ' ',
@CPID   nvarchar(30)   =   ' ',
@CPName nvarchar(50)   =   ' ',
@TransType nvarchar(10)   =   ' ',
@SItemPrice int   ,
@EItemPrice int   ,
@SDate nvarchar(8)   =   ' ',
@EDate nvarchar(8)   =   ' ',
@OrderID nvarchar(80)   =   ' ',
@UserID nvarchar(50)   =   ' ',
@totalAmt   money   =   0   output
)
AS
BEGIN
set   nocount   on

declare   @sSQL   nvarchar(4000),   @sSQLList   nvarchar(4000),   @sSQLCount   nvarchar(4000),   @sSQLAmt   nvarchar(4000),   @sSub   nvarchar(4000)

IF   @SItemPrice   IS   NULL   or   @SItemPrice   =   ' '
SET   @SItemPrice   =   0

IF   @EItemPrice   IS   NULL     or   @SItemPrice   =   ' '
SET   @EItemPrice   =   9999  

declare   @subPage_Size   nvarchar(10)
set   @subPage_Size   =   Convert(nvarchar(10),((Convert(int,@Page_No)     -   1)   *   Convert(int,@Page_Size)))

set   @sSQLList   =   '
select   top   '   +   @Page_Size   +   '   tid,   T_ORDER.no,   name,   provider_id,     TransType,   bank_transAmt,   bank_sysDate,   bank_sysSeqid,   user_id   '
set   @sSQLCount   =   '
select   count(*)   '
set   @sSQLAmt   =   '
select   sum(bank_transAmt)   '

set   @sSQL   =   '
from   T_ORDER   ,   T_PROVIDER
where   T_ORDER.provider_id   =   T_PROVIDER.no   and   bank_transAmt   between   '   +   convert(nvarchar(10),   @SItemPrice)   +   '   and   '   +   convert(nvarchar(10),   @EItemPrice)

IF   @SDate   <>   ' '   AND   @EDate   <>   ' '
SET   @sSQL   =   @sSQL   +   '
and   bank_sysDate   between   ' ' '   +   @SDate   + ' ' '   and   ' ' '   +   @EDate   + ' ' ' '
if   isnull(@CPID,   ' ')   <>   ' '
set   @sSQL   =   @sSQL   +   '  
and   cprovider_id   =   ' ' '   +   @CPID   +   ' ' ' '

if   isnull(@CPName,   ' ')   <>   ' '
set   @sSQL   =   @sSQL   +   '  
and   name   like   ' '% '   +   @CPName   +   '% ' ' '

if   isnull(@TID,   ' ')   <>   ' '
set   @sSQL   =   @sSQL   + &nbs