SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO
IF EXISTS (SELECT name FROM sysobjects 
         WHERE name = 'CIZACCSD' AND type = 'P')
   DROP PROCEDURE RPTUSER.CIZACCSD
GO


CREATE PROCEDURE RPTUSER.CIZACCSD
@P_ACCT_ID CHAR(10)

AS

/******************************************************************************
   NAME:       CIZACCSD
   PURPOSE:    

******************************************************************************/
BEGIN

    SELECT /*+ RULE */
        SUM( A.CUR_AMT) CUR_AMT,
        SUM( A.TOT_AMT) TOT_AMT,
        A.CURRENCY_CD,
        D.CUR_SYMBOL,
        D.DECIMAL_POSITIONS,
        D.SCALE_POSITIONS,
        D.CUR_POS_FLG
    FROM 
        CI_FT A, 
        CI_SA B, 
        CI_SA_TYPE C, 
        CI_CURRENCY_CD D
    WHERE 
        B.ACCT_ID = @P_ACCT_ID
        AND B.SA_ID = A.SA_ID
        AND C.SA_TYPE_CD = B.SA_TYPE_CD
        AND C.SPECIAL_ROLE_FLG = 'CD'
        AND A.REDUNDANT_SW = 'N'
        AND A.FREEZE_SW = 'Y'
        AND A.CURRENCY_CD = D.CURRENCY_CD
    GROUP BY 
        A.CURRENCY_CD,
        D.CUR_SYMBOL,
        D.DECIMAL_POSITIONS,
        D.SCALE_POSITIONS,
        D.CUR_POS_FLG
			 
RETURN

END



GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

