How to write the following CASE statement

I need to calculate Retainer amount. The derivation of it is as follows:
"A fixed value of 10000 per month for employees who have served for less than 2 years and 15000 for more than 2 years. This increment will be affected in two cycles a year, in the January or July."
The years of service can be calculated using date_of_joining.

Use this logic
SELECT DECODE(SIGN(SYSDATE - ADD_MONTHS(HIREDATE,24)),-1,10000,1,15000) from <table_name>Is this you need
In every Jan/July month employee get a Sal+Fixed allownce (10000 if less than 2 years in company/15000 if more than 2 years). In other month they get just the salary
SELECT CASE WHEN TO_CHAR(SYSDATE,'MM') IN ('01','07') THEN
               CASE WHEN SYSDATE- ADD_MONTHS(HIREDATE,24)> 0 THEN
                    SAL+15000
                ELSE
                    SAL+10000
                END
        ELSE
          SAL
        END  SAL
FROM EMP
/Edited by: Lokanath Giri on १७ सितंबर, २०१० ४:५६ अपराह्न

Similar Messages

  • How to tune the following sql statements which has two unions in oracle 10g

    It takes a long time to run the following sql statement in 10g. Each select brings back about 4 million rows and there will be about 12 million rows. When I run each select statements seprately in sqlplus I can see the data immedaitely but when I run it as whole with two unions in the select it just takes very very long time? I want to know how to make this run faster? Can we add hints? or is it because of any table space? Any help is appreciated.
    select
    D.EMPLID
    ,D.COMPANY
    ,'CY'
    ,D.CALENDAR_YEAR
    ,D.QTRCD
    ,D.ERNCD
    ,D.MONTHCD
    ,D.MONTHCD
    ,D.GRS_MTD
    ,D.GRS_QTD
    ,D.GRS_YTD
    ,D.HRS_MTD
    ,D.HRS_QTD
    ,D.HRS_YTD
    from PS_EARNINGS_BAL D
    where D.SPCL_BALANCE = 'N'
    union
    select
    D.EMPLID
    ,D.COMPANY
    ,'FY'
    ,(case when D.MONTHCD > '06' then D.CALENDAR_YEAR + 1 else D.CALENDAR_YEAR end)
    ,ltrim(to_char(to_number(D.QTRCD) + decode(sign(3-to_number(D.QTRCD)),1,2,-2),'9'))
    ,D.ERNCD
    ,ltrim(to_char(to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6),'09'))
    ,D.MONTHCD
    ,D.GRS_MTD
    ,D.GRS_QTD
    ,(select sum(F.GRS_MTD) from PS_EARNINGS_BAL F where
    F.EMPLID = D.EMPLID and
    F.COMPANY = D.COMPANY and
    F.ERNCD = D.ERNCD and
    F.SPCL_BALANCE = D.SPCL_BALANCE and
    (case when F.MONTHCD < '07' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
    = (case when D.MONTHCD < '07' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
    and to_number(F.MONTHCD) + decode(sign(7-to_number(F.MONTHCD)),1,6,-6)
    <= to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6))
    ,D.HRS_MTD
    ,D.HRS_QTD
    ,(select sum(F.HRS_MTD) from PS_EARNINGS_BAL F where
    F.EMPLID = D.EMPLID and
    F.COMPANY = D.COMPANY and
    F.ERNCD = D.ERNCD and
    F.SPCL_BALANCE = D.SPCL_BALANCE and
    (case when F.MONTHCD < '07' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
    = (case when D.MONTHCD < '07' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
    and to_number(F.MONTHCD) + decode(sign(7-to_number(F.MONTHCD)),1,6,-6)
    <= to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6))
    from PS_EARNINGS_BAL D
    where D.SPCL_BALANCE = 'N'
    union
    select
    D.EMPLID
    ,D.COMPANY
    ,'FF'
    ,(case when D.MONTHCD > '09' then D.CALENDAR_YEAR + 1 else D.CALENDAR_YEAR end)
    ,ltrim(to_char(to_number(D.QTRCD)+decode(sign(4-to_number(D.QTRCD)),1,1,-3),'9'))
    ,D.ERNCD
    ,ltrim(to_char(to_number(D.MONTHCD)+decode(sign(10-to_number(D.MONTHCD)),1,3,-9),'09'))
    ,D.MONTHCD
    ,D.GRS_MTD
    ,D.GRS_QTD
    ,(select sum(F.GRS_MTD) from PS_EARNINGS_BAL F where
    F.EMPLID = D.EMPLID and
    F.COMPANY = D.COMPANY and
    F.ERNCD = D.ERNCD and
    F.SPCL_BALANCE = D.SPCL_BALANCE and
    (case when F.MONTHCD < '10' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
    = (case when D.MONTHCD < '10' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
    and to_number(F.MONTHCD)+decode(sign(4-to_number(F.MONTHCD)),1,9,-3)
    <= to_number(D.MONTHCD)+decode(sign(4-to_number(D.MONTHCD)),1,9,-3))
    ,D.HRS_MTD
    ,D.HRS_QTD
    ,(select sum(F.HRS_MTD) from PS_EARNINGS_BAL F where
    F.EMPLID = D.EMPLID and
    F.COMPANY = D.COMPANY and
    F.ERNCD = D.ERNCD and
    F.SPCL_BALANCE = D.SPCL_BALANCE and
    (case when F.MONTHCD < '10' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
    = (case when D.MONTHCD < '10' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
    and to_number(F.MONTHCD)+decode(sign(4-to_number(F.MONTHCD)),1,9,-3)
    <= to_number(D.MONTHCD)+decode(sign(4-to_number(D.MONTHCD)),1,9,-3))
    from PS_EARNINGS_BAL D
    where D.SPCL_BALANCE = 'N'
    Edited by: user5846372 on Mar 11, 2009 8:55 AM

    Hi,
    What i observed is that your table name and where clause is same in all the thress SELECTs whereas columns having some manipulations that is not going to be unique. I guess you can easily replace UNION with UNION ALL.
    from PS_EARNINGS_BAL D
    where D.SPCL_BALANCE = 'N'Note: I am not aware of your data and business requirement. Please test the result before removing. It is just a suggetion
    Cheers,
    Avinash

  • How do i convert the following case statement to a table and still implement it in the store procedure.

    if @CustNo = '0142'          begin              insert #custnos (CustNo, ClientNo)              values ('0142', '1100')                      ,('0142', '1200')                      ,('0142', '1201')                      ,('0142', '1700')                      ,('0142', '1602')                      ,('0142', '1202')                      ,('0142', '1603')                      ,('0142', '2002')          endstore procUSE ODSSupport
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_NULLS ON
    GO
    if exists (select * from dbo.sysobjects where id = object_id(N'dbo.pr_Load_PASOArgusClaims_Work') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    BEGIN
    drop procedure dbo.pr_Load_PASOArgusClaims_Work
    IF OBJECT_ID ('dbo.pr_Load_PASOArgusClaims_Work') IS NOT NULL
    PRINT '<<< FAILED DROPPING PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    ELSE
    PRINT '<<< DROP PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    END
    GO
    CREATE PROC dbo.pr_Load_PASOArgusClaims_Work
    @BatchNo varchar(7) = null,
    @CustNo char(4) = null,
    @NewBatchNo varchar(7) = null
    AS
    /* Object dbo.pr_Load_PASOArgusClaims_Work 2006234 */
    -- SSR# : 2242
    -- Date : 12/23/2005
    -- Author : Roxy Newbill
    -- Description : Add new PASO BCAT 1602
    -- SSR# 1932 - 2/22/2006 SEN - Add logic to include only ArgusCustNo - 0142
    -- and change PharmacyClaim.ProcessDate to DateWritten
    -- SSR# : 2419
    -- Date : 08/22/2006
    -- Author : Betty Doran
    -- Description : PASO reports project
    -- Correct mapping of Dispense fee amt from 'AmtProfFee' to 'DispenseFee' -
    -- Mapping changed by Argus - did not inform PHP. Used in calcs for mClaimTotAmtCharge and
    -- mClaimAmtAllowed fields.
    -- SSR# : 2496
    -- Date : 06/27/2007
    -- Author : Roxy Newbil
    -- Description : PASO Reporting Project
    -- Add data load for new columns: Prescription No, Drug Name, NDC
    -- SSR# : PEBB PROJECT
    -- Date : 10/13/2009
    -- Author : Tj Meyer
    -- Description : Add BCAT 1201 for new PEBB business--
    -- SSR# : 132707
    -- Date : 12/17/2009
    -- Author : Terry Phillips
    -- Description : PASO Reporting Project
    -- Fix data length issues for Argus_SubGroupId,Argus_PlanCode,vchParticipantId,
    -- vchProviderId
    -- SSR# : 3253
    -- Date : 03/28/2011
    -- Author : Susan Naanes
    -- Description : PrescriptionNo increased in size from 7 to 12 characters
    -- SSR# : SPOCK project
    -- Date : 08/09/2012
    -- Author : Raymond Beckett
    -- Description : Modifed to bring in RxKey from PharmacyClaim instead of using identity value for iRecId
    -- Also, modified to load any new batches since last batch loaded into PASOArgusClaims
    -- if @BatchNo not supplied
    -- Various 'fixes'
    -- - removed grouping from initial query due to unique grouping caused by BatchNo, ClaimNumber, ClaimType
    -- SSR# : TFS 5264 - Premera Remediation -(3997)
    -- Date : 12/21/2012
    -- Author : Satish Pandey
    -- Description : Add BCATs 1202 and 1603 to the Where clause selecting pharmclm.ArgusClientNo as BCAT
    -- SSR# : TFS 10286
    -- Date : 1/15/2014
    -- Author : Raymond Beckett
    -- Description : Add HRI Customer Number and BCAT's. Also add Customer Number and alternate batchno to parameters
    -- Only use '@NewBatchNo' if adding data from missed custno and the batchno already exists in PASOArgusClaims
    -- ITSM Ticket : 1800925
    -- Date : 4/15/2014
    -- Author : Roxy Newbill
    -- Description : Silverton Hospital had new BCAT (2002) with start of 2014 business. This was never accomodated for
    -- Adding this BCAT in so that we can start capturing these claims (Note, special insert being done to capture
    -- all BCAT 2002 claims prior to this fix.)
    -- ITSM Ticket : TFS 14587 -Intel BCAT Remediation
    -- Date : 08/14/2014
    -- Author : Andrew Omofonma
    -- Description : Added BCAT's (1604,& 2103) for Intel
    SET NOCOUNT ON
    DECLARE @iCount int
    create table #tmpArgusWork (
    iRecId int,
    BatchNo varchar (7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    BatchDateTime datetime NULL ,
    BatchStatus varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    ReadyDateTime datetime NULL ,
    Argus_GroupId varchar (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    Argus_SubGroupId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_ClassId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_PlanCode varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_BusinessCategory varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    FacetsClaimSubType varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASOClaimType varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    vchClaimNumber varchar (14) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    dtPaidDate datetime NULL ,
    dtProcessDate datetime NULL ,
    dtServiceDate datetime NULL ,
    vchParticipantId varchar (14) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    vchProviderId varchar (12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    vchProviderName varchar (55) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    mClaimTotAmtCharge money NULL ,
    mClaimAmtDiscount money NULL ,
    mClaimAmtAllowed money NULL ,
    mClaimAmtDenied money NULL ,
    mClaimAmtDeduct money NULL ,
    mClaimAmtCoinsurance money NULL ,
    mClaimAmtCopay money NULL ,
    mClaimAmtPaid money NULL ,
    PASO_GroupId varchar (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_SubGroupId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_ClassID varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_PlanCode varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_BusinessCategory varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    RecordStatus varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    ErrorDesc varchar (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    PrescriptionNo char(12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    DrugName varchar(30)COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    NDC char(11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    create table #batches (
    BatchNo char(7) not null
    primary key (BatchNo))
    create table #custnos (
    CustNo char(4),
    ClientNo char(5), -- bcats associated with the customer
    primary key (CustNo, ClientNo)
    DECLARE
    @len_Argus_SubGroupId smallint,
    @len_Argus_PlanCode smallint,
    @len_vchParticipantId smallint,
    @len_vchProviderId smallint
    --Get field lengths for the following fields
    SELECT @len_Argus_SubGroupId = 4, --datalength([@tmpArgusWork].[Argus_SubGroupId]),
    @len_Argus_PlanCode = 8, --datalength(@tmpArgusWork.Argus_PlanCode),
    @len_vchParticipantId = 14, --datalength(@tmpArgusWork.vchParticipantId),
    @len_vchProviderId = 12 --datalength(@tmpArgusWork.vchProviderId)
    declare @maxbatch char(7)
    IF @BatchNo IS NULL
    begin
    -- assume normal run. Add ClientNo's and custno's to tables
    insert #custnos (CustNo, ClientNo)
    values ('0142', '1100')
    ,('0142', '1200')
    ,('0142', '1201')
    ,('0142', '1700')
    ,('0142', '1602')
    ,('0142', '1202')
    ,('0142', '1603')
    ,('0142', '2002')
    ,('0142', '1604')
    ,('0142', '2103')
    ,('0669', '*')
    -- get batches loaded since last batch loaded into PASOArgusClaims
    SELECT @maxbatch=Max(BatchNo)
    FROM ODSSupport.dbo.PASOArgusClaims
    declare @dt datetime
    declare @ds datetime
    select @dt = MIN(DateTimeStamp)
    from ODS.dbo.PharmacyClaim_Common
    where BatchNo <= @maxbatch
    and DateTimeStamp > DATEADD(dd,-16,getdate())
    insert #batches (BatchNo)
    select distinct BatchNo
    from ODS.dbo.PharmacyClaim_Common pcc
    inner join #custnos ct
    on ct.CustNo = pcc.ArgusCustNo
    and (
    ct.ClientNo = '*'
    or
    ct.ClientNo = pcc.ArgusClientNo
    where DateTimeStamp > @dt
    ; -- batch may have had a claim altered since last load, drop any batches already loaded into PASOArgusClaims
    with pba as (
    select distinct BatchNo
    from ODSSupport.dbo.PASOArgusClaims
    delete ba
    from #batches ba
    inner join pba
    on pba.BatchNo = ba.BatchNo
    end
    else if @NewBatchNo is not null and @CustNo is not null
    begin
    --make sure we haven't already done this batch number/customer combination
    set @maxbatch = @NewBatchNo
    SELECT @iCount=count(*)
    FROM PASOArgusClaims
    WHERE BatchNo=@maxbatch
    and Argus_BusinessCategory = @CustNo
    IF @iCount > 0
    begin
    PRINT 'Msg: Batch ' + @maxbatch + ' already exists for CustNo ' + @CustNo + '.'
    end
    else
    begin
    if @CustNo = '0142'
    begin
    insert #custnos (CustNo, ClientNo)
    values ('0142', '1100')
    ,('0142', '1200')
    ,('0142', '1201')
    ,('0142', '1700')
    ,('0142', '1602')
    ,('0142', '1202')
    ,('0142', '1603')
    ,('0142', '2002')
    ,('0142', '1604')
    ,('0142', '2103')
    end
    if @CustNo = '0669'
    begin
    insert #custnos (CustNo, ClientNo)
    values ('0669', '*')
    end
    insert #batches (BatchNo)
    values (@BatchNo)
    end
    end
    else
    begin
    --make sure we haven't already done this batch number
    set @maxbatch = @BatchNo
    SELECT @iCount=count(*)
    FROM PASOArgusClaims
    WHERE BatchNo=@maxbatch
    IF @iCount > 0
    begin
    PRINT 'Msg: Batch ' + @maxbatch + ' already loaded.'
    end
    else
    begin
    insert #batches (BatchNo)
    values (@maxbatch)
    end
    end
    ** Insert Pharmacy Claims to temporary table
    INSERT INTO #tmpArgusWork
    SELECT
    pharmClm.RxKey,
    isnull(@NewBatchNo, pharmClm.BatchNo),
    pharmclm.OrigDateTimeStamp as BatchDateTime,
    'PENDING' as BatchStatus,
    NULL as ReadyDateTime,
    substring(pharmClm.GrpNumber,1,8)as Argus_GroupID,
    left(pharmClm.ArgusSubgroup1,@len_Argus_SubGroupId) as Argus_SubgroupID,
    substring(pharmClm.GrpNumber,9,4) as Argus_ClassId,
    substring(pharmClm.GrpNumber,13,@len_Argus_PlanCode) as Argus_PlanCode,
    pharmClm.ArgusClientNo as Argus_BusinessCategory,
    '' as vchFacetsClaimSubtype,
    PASOClaimType = CASE WHEN pharmClm.ClaimType='A'
    THEN 'PHARMACY-ADJUST'
    ELSE 'PHARMACY'
    END,
    pharmClm.ClaimNo,
    pharmClm.DateCutoff as dtPaidDate,
    pharmClm.DateWritten as dtProcessDate,
    NULL as dtServiceDate,
    left(pharmClm.MemberId,@len_vchParticipantId) as vchParticipantId,
    left(pharmClm.PharmacyNo,@len_vchProviderId) as vchProviderId,
    vchProviderName = CASE WHEN pharmclm.PayMemberInd = 'Y'
    THEN 'Member Reimbursement'
    ELSE pharm.PharmName
    END,
    mClaimTotAmtCharge = CASE WHEN pharmclm.PayMemberInd = 'Y' -- When this is a member reimbursement use the amt paid
    THEN isnull(pharmClm.IngredientCostPaid,0) + isnull(pharmClm.DispenseFee,0) + isnull(APSFee,0) -- as amt charged.
    ELSE isnull(pharmClm.AmtBilled,0)
    END,
    case when pharmclm.PayMemberInd = 'Y'
    then isnull(pharmClm.AmtRejected,0) * -1
    else isnull(pharmClm.AmtBilled,0) - isnull(pharmClm.IngredientCostPaid,0) - isnull(pharmClm.DispenseFee,0) - isnull(APSFee,0) -isnull(pharmClm.AmtRejected,0)
    end as mClaimAmtDiscount,
    isnull(pharmClm.IngredientCostPaid,0) + isnull(pharmClm.DispenseFee,0) + isnull(APSFee,0) as mClaimAmtAllowed,
    isnull(pharmClm.AmtRejected,0) as mClaimAmtDenied,
    isnull(pharmClm.MemberPaidAmt,0) - isnull(pharmClm.MemberCopayAmt,0) as mClaimAmtDeduct,
    0 as mClaimAmtCoinsurance,
    isnull(pharmClm.MemberCopayAmt,0) as mClaimAmtCopay,
    isnull(pharmClm.AmtPaid,0) + isnull(APSFee,0) as mClaimAmtPaid,
    NULL as PASO_GroupID,
    NULL as PASO_SubgroupID,
    NULL as PASO_ClassID,
    NULL as PASO_PlanCode,
    NULL as PASO_BusinessCategory,
    'OK' as RecordStatus,
    NULL as ErrorDesc,
    PrescriptionNo = pharmClm.PrescriptionNo,
    DrugName = pharmClm.DrugName,
    NDC = pharmClm.NDC
    FROM ODS..PharmacyClaim as pharmClm
    LEFT JOIN ODS..pharmacy as pharm on
    pharmClm.PharmacyNo = pharm.PharmacyNo
    INNER join #batches ba
    on ba.BatchNo = pharmClm.BatchNo
    INNER join #custnos ct
    on ct.CustNo = pharmClm.ArgusCustNo
    and (
    ct.ClientNo = '*'
    or
    ct.ClientNo = pharmClm.ArgusClientNo
    WHERE pharmClm.ClaimType in ('P','A') -- Processed or Adjusted
    --AND pharmClm.ProcessCode <> 'MC' --code doesn't exist
    --GROUP BY
    -- pharmClm.BatchNo,
    -- substring(pharmClm.GrpNumber,1,8),
    -- substring(pharmClm.GrpNumber,9,4) ,
    -- substring(pharmClm.GrpNumber,13,@len_Argus_PlanCode),
    -- pharmClm.ArgusSubgroup1,
    -- pharmClm.ClaimNo,
    -- pharmClm.ArgusClientNo,
    -- pharmClm.DateCutoff,
    -- pharmClm.DateWritten,
    -- pharmClm.MemberId,
    -- pharmClm.PayMemberInd,
    -- pharmClm.PharmacyNo,
    -- pharm.PharmName,
    -- pharmClm.OrigDateTimeStamp,
    -- pharmClm.ClaimType,
    -- pharmClm.PrescriptionNo,
    -- pharmClm.DrugName,
    -- pharmClm.NDC
    IF @@RowCount=0
    BEGIN
    PRINT 'Msg: No records found.'
    RETURN
    END
    --Update the Discount column for these Pharmacy Claims
    --UPDATE @tmpArgusWork
    --SET mClaimAmtDiscount=mClaimTotAmtCharge-mClaimAmtAllowed-mClaimAmtDenied
    ** Get the lowest service Date for each claim and update temp table
    UPDATE #tmpArgusWork
    SET dtServiceDate = (SELECT min(pharmclm.DateSvc)
    FROM ODS..pharmacyClaim AS pharmclm
    WHERE pharmclm.ClaimNo = tcpr.vchClaimNumber
    AND pharmclm.MemberID = tcpr.vchParticipantId)
    FROM #tmpArgusWork as tcpr
    ** Copy over the eligibility fields that Argus provided
    UPDATE #tmpArgusWork
    SET PASO_GroupId = Argus_GroupID,
    PASO_SubGroupId = Argus_SubGroupId,
    PASO_ClassID=Argus_classid,
    PASO_PlanCode=Argus_PlanCode,
    PASO_BusinessCategory=Argus_BusinessCategory
    FROM #tmpArgusWork pw
    WHERE COALESCE(Argus_GroupID,'') <> ''
    OR COALESCE(Argus_SubGroupId,'') <> ''
    OR COALESCE(Argus_classid,'') <> ''
    OR COALESCE(Argus_PlanCode,'') <> ''
    OR COALESCE(Argus_BusinessCategory,'') <> ''
    ** If Argus did not provide all 5 eligibility fields, get them from faEnrollmentHistory
    ** based on the group, member, date of service
    UPDATE #tmpArgusWork
    SET PASO_GroupId = eh.GroupId,
    PASO_SubGroupId = eh.SubGroupId,
    PASO_ClassID=eh.Class,
    PASO_PlanCode=eh.PlanCode,
    PASO_BusinessCategory=eh.BusinessCategory
    FROM #tmpArgusWork pw
    INNER JOIN ODS..FAEnrollmentHistory eh
    ON eh.MemberID =pw.vchParticipantID
    AND eh.Groupid =pw.Argus_GroupID
    AND eh.eligind='Y'
    AND eh.ProcessCode<>'ID'
    AND pw.dtServiceDate BETWEEN eh.EligEffDate AND eh.EligTermDate
    WHERE COALESCE(Argus_GroupID,'') = ''
    OR COALESCE(Argus_SubGroupId,'') = ''
    OR COALESCE(Argus_classid,'') = ''
    OR COALESCE(Argus_PlanCode,'') = ''
    OR COALESCE(Argus_BusinessCategory,'') = ''
    ** If we have eligibility for all records, go ahead and set the ready date to today.
    IF NOT EXISTS ( SELECT *
    FROM #tmpArgusWork
    WHERE COALESCE(PASO_GroupID,'') = ''
    OR COALESCE(PASO_SubGroupID,'') = ''
    OR COALESCE(PASO_ClassID,'') = ''
    OR COALESCE(PASO_PlanCode,'') = ''
    OR COALESCE(PASO_BusinessCategory,'') = '')
    BEGIN
    UPDATE #tmpArgusWork
    SET ReadyDateTime=convert(varchar(10),GetDate(),101),
    BatchStatus='READY'
    END
    ELSE
    BEGIN
    PRINT 'Msg: Exceptions found.'
    UPDATE #tmpArgusWork
    SET RecordStatus='ERR',
    ErrorDesc='No valid Eligible span for this Member/Group/Subgroup at time of Service'
    WHERE COALESCE(PASO_GroupID,'') = ''
    OR COALESCE(PASO_SubGroupId,'') = ''
    OR COALESCE(PASO_ClassID,'') = ''
    OR COALESCE(PASO_PlanCode,'') = ''
    OR COALESCE(PASO_BusinessCategory,'') = ''
    END
    ** Insert the records into the final table.
    INSERT INTO PASOArgusClaims
    SELECT * FROM #tmpArgusWork
    SET NOCOUNT OFF
    END
    GO
    -- Verify that the stored procedure was created successfully.
    IF OBJECT_ID ('dbo.pr_Load_PASOArgusClaims_Work') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    GO
    GRANT EXECUTE ON dbo.pr_Load_PASOArgusClaims_Work to role_ODSLoad
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON

    this part of the code below
    if@CustNo
    = '0142'
       begin
    insert #custnos(CustNo,
    ClientNo)
    values ('0142',
    '1100')
    ,('0142',
    '1200')
    ,('0142',
    '1201')
    ,('0142',
    '1700')
    ,('0142',
    '1602')
    ,('0142',
    '1202')
    ,('0142',
    '1603')
    ,('0142',
    '2002')
       end
    store proc
    How do I covert it to a common table where the values can be selected from when needed.

  • How to convert the compund case statement into decode statement

    (CASE
    WHEN FRCST = 0 AND SALE = 0 THEN 'No transaction '
    WHEN FRCST = 0 AND SALE <>0 THEN 'Sale ag. Nil Forecast : '||SALE||' Kgs'
    WHEN FRCST<> 0 AND SALE = 0 THEN 'No Sale ag. Forecast : '||FRCST||' Kgs'
    WHEN FRCST<>0 AND SALE<>0 AND DIFF=0 THEN 'No Variance'
    ELSE TO_CHAR(ROUND((DIFF/FRCST),2))||'%'
    END)VARIANCE
    How to convert this tatement to decode statement ?
    Yogesh

    Decode(FRCST,0,DECODE(SALE,0,'nO TRANSACTION','SALE AGAINST NIL FORECAST'),DECODE(SALE,0,'NO SALE AGAINST FORECAST',
    DECODE(|SALE-FORECAST|,0,'NO VARIANCE',TO_CHAR(ROUND((DIFF/FRCST),2))||'%')))As per me whole case can be replaced by above decode

  • How to write the following SELECT

    CARDS     Commission
    0-20     0
    21-25     500
    26-31     650
    32-36     850
    37>     1050
    If an PERSON sells 28 cards in a month, commission would be computed as below.
    25*500 = 12500
    3*650 = 1950
    Total commission 14450

    New solution:
    SQL > var cards_sold       NUMBER;
    SQL > exec :cards_sold := 28;
    PL/SQL procedure successfully completed.
    SQL >
    SQL > WITH COMM_TABLE AS
      2  (
      3     SELECT 0 AS MIN_CARD, 20 AS MAX_CARD, 0 AS COMMISSION FROM DUAL UNION ALL
      4     SELECT 21 AS MIN_CARD, 25 AS MAX_CARD, 500 AS COMMISSION FROM DUAL UNION ALL
      5     SELECT 26 AS MIN_CARD, 31 AS MAX_CARD, 650 AS COMMISSION FROM DUAL UNION ALL
      6     SELECT 32 AS MIN_CARD, 36 AS MAX_CARD, 850 AS COMMISSION FROM DUAL UNION ALL
      7     SELECT 37 AS MIN_CARD, NULL AS MAX_CARD, 1000 AS COMMISSION FROM DUAL
      8  )
      9  SELECT     LEAD(PART_COMMISSION,1) OVER (ORDER BY MAX_CARD DESC)
    10             +       (:cards_sold-LEAD(MAX_CARD,1) OVER (ORDER BY MAX_CARD DESC))*COMMISSION  AS COMMISSION
    11  FROM
    12  (
    13     SELECT  COMM_TABLE.*
    14     ,       COMM_TABLE.COMMISSION*COMM_TABLE.MAX_CARD AS PART_COMMISSION
    15     FROM    COMM_TABLE
    16     WHERE   MIN_CARD <= :cards_sold
    17     ORDER BY MIN_CARD DESC
    18  )
    19  WHERE ROWNUM <= 2;
    COMMISSION
         14450Explanation:
    /* According to your requirements commission is calculated in two parts.
    * The first part is equal to the COMMISSION value for the RANGE that the :cards_sold exceeds (21-25 in this case)
    * multiplied by the MAX_CARDs value in that range. This is indicated by (A) below.
    * The second part is the COMMISSION in the range that the :cards_sold is included in multipled by the
    * difference of the :cards_sold and the MAX_CARD values for the RANGE that the :cards_sold exceeds (21-25 in this case).
    * This is indicated by (B) below.
    SELECT      LEAD(PART_COMMISSION,1) OVER (ORDER BY MAX_CARD DESC) /* (A) */
              +     (:cards_sold-LEAD(MAX_CARD,1) OVER (ORDER BY MAX_CARD DESC))*COMMISSION /* (B) */ AS COMMISSION
    FROM
         SELECT      COMM_TABLE.*
         ,     COMM_TABLE.COMMISSION*COMM_TABLE.MAX_CARD AS PART_COMMISSION /* (A) */     
         FROM     COMM_TABLE
         WHERE     MIN_CARD <= :cards_sold     /* We are only interested in the entries where the # of cards sold is greater than the minimum */
         ORDER BY MIN_CARD DESC
    WHERE ROWNUM <= 2; /* Only need one commission value */

  • How to write the sql statement of my finder function in cmp?

    hi,
    I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
    select * from INFOCOLUMN WHERE employee_id=id
    employee_id is a column of the table,and id is the finder function parameter.
    The error is : invalid column name
    So,how to write the sql statement.
    Thanks .

    Mole-
    Bind variables are of the form $1, $2, etc., so your query stmt should look like:
    select * from INFOCOLUMN WHERE employee_id=$1
    -Jon

  • How to write the exceptions in function module

    dear all,
         how to write the exceptions in function modules with example.
    thanq
    jyothi

    Hi,
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in function modules:
    RAISE except.
    und
    MESSAGE.....RAISING except.
    The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
    If the calling program does not handle the exception
    · The RAISEstatement terminates the program and switches to debugging mode.
    · The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
    If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION read_spfli_into_table.
    ""Local Interface:
    *" IMPORTING
    *" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
    *" EXPORTING
    *" VALUE(ITAB) TYPE SPFLI_TAB
    *" EXCEPTIONS
    *" NOT_FOUND
    SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
    IF sy-subrc NE 0.
    MESSAGE e007(at) RAISING not_found.
    ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
    Calling READ_SPFLI_INTO_TABLE
    The following program calls the function module READ_SPFLI_INTO_TABLE:
    REPORT demo_mod_tech_fb_read_spfli.
    PARAMETERS carrier TYPE s_carr_id.
    DATA: jtab TYPE spfli_tab,
    wa LIKE LINE OF jtab.
    CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
    EXPORTING
    id = carrier
    IMPORTING
    itab = jtab
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    CASE sy-subrc.
    WHEN 1.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
    WHEN 2.
    MESSAGE e702(at).
    ENDCASE.
    LOOP AT jtab INTO wa.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDLOOP.
    The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
    Or
    just have to decide what exceptions u want and under what conditions.
    then declarethese exeptions under the exceptions tab.
    in the source code of ur function module.
    if
    like this u can code .
    now when u call the function module in tme mainprogram.
    if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
    in the fm u can program these sy-subrc values and trigger the code for ur exception.
    Please reward if useful
    Regards,
    Ravi
    Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM

  • Programming help - how to get the read-only state of PDF file is windows explorer preview is ON?

    Programming help - how to get the read-only state of PDF file is windows explorer preview is ON?
    I'm developing an application where a file is need to be saved as pdf. But, if there is already a pdf file with same name in the specified directory, I wish to overwrite it. And in the overwrite case, read-only files should not be overwritten. If the duplicate(old) file is opened in windows (Win7) explorer preview, it is write protected. So, it should not be overwritten. I tried to get the '
    FILE_ATTRIBUTE_READONLY' using MS API 'GetFileAttributes', but it didn't succeed. How Adobe marks the file as read-only for preview? Do I need to check some other attribute of the file?
    Thanks!

    Divya - I have done it in the past following these documents. Please read it and try it it will work.
    Please read it in the following order since both are a continuation documents for the same purpose (it also contains how to change colors of row dynamically but I didnt do that part I just did the read_only part as your requirement) 
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b?quicklink=index&overridelayout=true
    thanks!
    Jason PV

  • How to write the start routine in the transformations ?

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

  • How to write the logic for extending Idocs...

    Hi,
          Can anybody pls explain how to write the logic for extending IDOCs with an example...
          Good suggestions can be appreciated..
    Regards,
    Ram

    Hi Ram,
    Generally the IDoc user exit is called at the following places:
      1) When the control record is read.
      2) After each and every segment in the data record
      3) At the end of the data segment processing.
    The IDoc user exit interface generally imports IDOC_DATA (data record internal table) table. Now the data records in the internal table should appear in the same order as maintained while defining IDoc structure (WE30 transaction). For SAP standard segment SAP code will take care of this. For extended segment you will have to take care of this aspect by appending the Z-segment in the IDOC_DATA table.
    You can do this by:
             looping at IDOC_DATA table:
                 - Do a case-endcase fo IDOC_DATA-SEGNAM (This stores the segment 
                   structure as per the hierarchy).
                 - Within the case for "Z-segment" you can write the logic for appending
                   the Z-segment to IDOC_DATA-SDATA.
    Hope this gives some clue.
    Regards,
    Gajendra.

  • Increase performance of the following SELECT statement.

    Hi All,
    I have the following select statement which I would want to fine tune.
      CHECK NOT LT_MARC IS INITIAL.
      SELECT RSNUM
             RSPOS
             RSART
             MATNR
             WERKS
             BDTER
             BDMNG FROM RESB
                          INTO TABLE GT_RESB 
                          FOR ALL ENTRIES IN LT_MARC
                          WHERE XLOEK EQ ' '
                          AND MATNR EQ LT_MARC-MATNR
                          AND WERKS EQ P_WERKS
                          AND BDTER IN S_PERIOD.
    The following query is being run for a period of 1 year where the number of records returned will be approx 3 million. When the program is run in background the execution time is around 76 hours. When I run the same program dividing the selection period into smaller parts I am able to execute the same in about an hour.
    After a previous posting I had changed the select statement to
      CHECK NOT LT_MARC IS INITIAL.
      SELECT RSNUM
             RSPOS
             RSART
             MATNR
             WERKS
             BDTER
             BDMNG FROM RESB
                          APPENDING TABLE GT_RESB  PACKAGE SIZE LV_SIZE
                          FOR ALL ENTRIES IN LT_MARC
                          WHERE XLOEK EQ ' '
                          AND MATNR EQ LT_MARC-MATNR
                          AND WERKS EQ P_WERKS
                          AND BDTER IN S_PERIOD.
      ENDSELECT.
    But the performance improvement is very negligible.
    Please suggest.
    Regards,
    Karthik

    Hi Karthik,
    <b>Do not use the appending statement</b>
    Also you said if you reduce period then you get it quickly.
    Why not try dividing your internal table LT_MARC into small internal tables having max 1000 entries.
    You can read from index 1 - 1000 for first table. Use that in the select query and append the results
    Then you can refresh that table and read table LT_MARC from 1001-2000 into the same table and then again execute the same query.
    I know this sounds strange but you can bargain for better performance by increasing data base hits in this case.
    Try this and let me know.
    Regards
    Nishant
    > I have the following select statement which I would
    > want to fine tune.
    >
    >   CHECK NOT LT_MARC IS INITIAL.
    > SELECT RSNUM
    >          RSPOS
    > RSART
    >          MATNR
    > WERKS
    >          BDTER
    > BDMNG FROM RESB
    >                       INTO TABLE GT_RESB 
    > FOR ALL ENTRIES IN LT_MARC
    >                       WHERE XLOEK EQ ' '
    > AND MATNR EQ LT_MARC-MATNR
    >                       AND WERKS EQ P_WERKS
    > AND BDTER IN S_PERIOD.
    >  
    > e following query is being run for a period of 1 year
    > where the number of records returned will be approx 3
    > million. When the program is run in background the
    > execution time is around 76 hours. When I run the
    > same program dividing the selection period into
    > smaller parts I am able to execute the same in about
    > an hour.
    >
    > After a previous posting I had changed the select
    > statement to
    >
    >   CHECK NOT LT_MARC IS INITIAL.
    > SELECT RSNUM
    >          RSPOS
    > RSART
    >          MATNR
    > WERKS
    >          BDTER
    > BDMNG FROM RESB
    > APPENDING TABLE GT_RESB
    >   PACKAGE SIZE LV_SIZE
    >                     FOR ALL ENTRIES IN LT_MARC
    >   WHERE XLOEK EQ ' '
    >                     AND MATNR EQ LT_MARC-MATNR
    >   AND WERKS EQ P_WERKS
    >                     AND BDTER IN S_PERIOD.
    > the performance improvement is very negligible.
    > Please suggest.
    >
    > Regards,
    > Karthik
    Hi Karthik,

  • How to write the nodevalue back to xml file?

    Hi, Everybody:
    These are two packages I used. javax.xml.parsers.*,org.w3c.dom.*
    Now I use "setNodeValue("abc") to set the node value to "abc". But it is not really saved back into XML file. It only change the node value in memory.
    How to write the changes back to XML file? Thank you very much for your help.
    Michelle

    * Version : 1.00
    * File Purpose : Given the xml file loads into dom and recreate the file with the updated values.
    * Developer : Kashif Qasim : 25/july/04
    * Modify detail :
    import java.lang.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import org.w3c.dom.*;
    import org.apache.xerces.parsers.DOMParser;
    import org.apache.xerces.*;
    public class XMLWriter
    private String displayStrings[] = new String[5000];
    private int numberDisplayLines = 0;
    private Document document;
    //private final Node c;
    public synchronized void displayDocument(String uri,Vector UpdatedValues,String getTaskID)
    try {
    DOMParser parser = new DOMParser();
    parser.parse(uri);
    document = parser.getDocument();
    display(document, "",UpdatedValues);
    } catch (Exception e) {
    e.printStackTrace(System.err);
    ReadXmlConfig objReadXmlConfig = null;
    FileWriter filewriter = null;
    try {
    filewriter = new FileWriter(uri);
    for(int loopIndex = 0; loopIndex < numberDisplayLines; loopIndex++){
    filewriter.write(displayStrings[loopIndex].toCharArray());
    //System.out.println("displayStrings[loopIndex].toCharArray() "+displayStrings[loopIndex].toString());
    //filewriter.write("\n");
    filewriter.close();
    System.gc();
    objReadXmlConfig = new ReadXmlConfig();
    objReadXmlConfig.ITSLog("File updated for "+getTaskID+" succesfully, file is closed now ");
    } catch (IOException e) {
    System.err.println("Caught IOException: " + e.getMessage());
    objReadXmlConfig = new ReadXmlConfig();
    objReadXmlConfig.ITSErrorLog("File updated FAILED for "+getTaskID+". Reason for file error "+e.toString());
    }finally {
    if (filewriter != null) {
    System.out.println("Closing File");
    objReadXmlConfig =null;
    try{
    filewriter.close();
    }catch(IOException e){
    System.err.println("Caught IOException: " + e.getMessage());
    } else {
    System.out.println("File not open");
    private void display(Node node, String indent, Vector UpdtRecs)
    if (node == null) {
    return;
    int type = node.getNodeType();
    NodeList nodeList = document.getElementsByTagName("QueryParm");
    int TotalRecs = UpdtRecs.size();
    switch (type) {
    case Node.DOCUMENT_NODE: {
    displayStrings[numberDisplayLines] = indent;
    displayStrings[numberDisplayLines] +=
    "<?xml version=\"1.0\" encoding=\""+
    "UTF-8" + "\"?>";
    numberDisplayLines++;
    displayStrings[numberDisplayLines] += "\n";
    display(((Document)node).getDocumentElement(), "",UpdtRecs);
    break;
    case Node.ELEMENT_NODE: {
    if(node.getNodeName().equals("QueryParm")) {
    for(int i =0 ; i< nodeList.getLength() ; i++)
    Node nodeQry = nodeList.item(i);
    NamedNodeMap nnp = nodeQry.getAttributes();
    for(int j= 0 ; j < nnp.getLength() ; j++)
    Attr atr = (Attr) nnp.item(j);
    if(atr.getName().equalsIgnoreCase("value_"+(i+1)))
    //System.out.println(atr.getName() +" : " + atr.getNodeValue() );
    atr.setNodeValue(UpdtRecs.get(i).toString());
    displayStrings[numberDisplayLines] = indent;
    displayStrings[numberDisplayLines] += "<";
    displayStrings[numberDisplayLines] += node.getNodeName();
    int length = (node.getAttributes() != null) ?
    node.getAttributes().getLength() : 0;
    Attr attributes[] = new Attr[length];
    for (int loopIndex = 0; loopIndex < length; loopIndex++) {
    attributes[loopIndex] = (Attr)node.getAttributes().item(loopIndex);
    for (int loopIndex = 0; loopIndex < attributes.length; loopIndex++) {
    Attr attribute = attributes[loopIndex];
    displayStrings[numberDisplayLines] += " ";
    displayStrings[numberDisplayLines] += attribute.getNodeName();
    displayStrings[numberDisplayLines] += "=\"";
    displayStrings[numberDisplayLines] += attribute.getNodeValue();
    displayStrings[numberDisplayLines] += "\"";
    displayStrings[numberDisplayLines]+=">";
    numberDisplayLines++;
    NodeList childNodes = node.getChildNodes();
    if (childNodes != null) {
    length = childNodes.getLength();
    indent += " ";
    for (int loopIndex = 0; loopIndex < length; loopIndex++ ) {
    display(childNodes.item(loopIndex), indent,UpdtRecs);
    break;
    case Node.CDATA_SECTION_NODE: {
    displayStrings[numberDisplayLines] = "";
    displayStrings[numberDisplayLines] += "<![CDATA[";
    displayStrings[numberDisplayLines] += node.getNodeValue();
    displayStrings[numberDisplayLines] += "]]>";
    numberDisplayLines++;
    break;
    case Node.TEXT_NODE: {
    displayStrings[numberDisplayLines] = "";
    String newText = node.getNodeValue().trim();
    if(newText.indexOf("\n") < 0 && newText.length() > 0) {
    displayStrings[numberDisplayLines] += newText;
    displayStrings[numberDisplayLines] += "\n";
    numberDisplayLines++;
    break;
    case Node.PROCESSING_INSTRUCTION_NODE: {
    displayStrings[numberDisplayLines] = "";
    displayStrings[numberDisplayLines] += "<?";
    displayStrings[numberDisplayLines] += node.getNodeName();
    String text = node.getNodeValue();
    if (text != null && text.length() > 0) {
    displayStrings[numberDisplayLines] += text;
    displayStrings[numberDisplayLines] += "?>";
    displayStrings[numberDisplayLines] += "\n";
    numberDisplayLines++;
    break;
    if (type == Node.ELEMENT_NODE) {
    displayStrings[numberDisplayLines] = indent.substring(0,
    indent.length() - 4);
    displayStrings[numberDisplayLines] += "</";
    displayStrings[numberDisplayLines] += node.getNodeName();
    displayStrings[numberDisplayLines] += ">";
    displayStrings[numberDisplayLines] += "\n";
    numberDisplayLines++;
    indent += " ";
    public static void main(String args[])
    Vector xmlValue = new Vector();
    xmlValue.add(0,"Kashif");
    xmlValue.add(1,"Qasim");
    //displayDocument("NewMediation.xml",xmlValue);
    <?xml version="1.0" encoding="UTF-8"?>
    <Mediation>
    <Task1>
    <Source>
    <SourceDriver>com.microsoft.jdbc.sqlserver.SQLServerDriver</SourceDriver>
    <SourceConnection>jdbc:microsoft:sqlserver://10.2.1.58:1433;DatabaseName=MTCVB_HDS;</SourceConnection>
    <SourceUser>sa</SourceUser>
    <SourcePassword>sa</SourcePassword>
    <Table>
    <SourceTable>t_Agent</SourceTable>
    <SourceQuery><![CDATA[SELECT SkillTargetID,PersonID,PeripheralID,EnterpriseName,PeripheralNumber,Deleted,TemporaryAgent,AgentStateTrace,ChangeStamp FROM t_Agent where SkillTargetID > {value_1} order by SkillTargetID]]>
    </SourceQuery>
    <SourceParm BusinessRule="" ColumnName="SKILLTARGETID" ColumnNumber="1" DataType="Numeric" DefaultValue="0" Format="mm/dd/yyyy xx:xx:xx XX">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="PERSONID" ColumnNumber="2" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="PERIPHERALID" ColumnNumber="3" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="ENTERPRISENAME" ColumnNumber="4" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="PERIPHERALNUMBER" ColumnNumber="5" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="DELETED" ColumnNumber="6" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="TEMPORARYAGENT" ColumnNumber="7" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="AGENTSTATETRACE" ColumnNumber="8" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="CHANGESTAMP" ColumnNumber="9" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <QueryParm FldName_1="SkillTargetID" FldType_1="Number" value_1="0">
    </QueryParm>
    </Table>
    </Source>
    </Task1>
    </Mediation>
    The QueryParm values are updated thru this code :)
    Hope it helps u ...

  • How to write the grec letter "delta"

    Hello
    In my program java, I want to write the lower case grec letter "delta" in order to do : JLabel lab= new JLabel("delta"), but I don't know how to write the "delta". Please help me, thanks.
    danfei

    You can find a unicode list at
    http://www.unicode.org/Public/MAPPINGS/EASTASIA/GB/GB2312.TXT
    0x2644     0x03B4     # GREEK SMALL LETTER DELTA

  • How to write the condition

    Hi guys, I wonder how to do this in Disco Desktop( not in admin). How to write the exists like a statement in “where close”
    select * from emp
    where exists (select 'x' from emp_1
    where emp_1.sal>2999
    and empno=emp.empno)
    Thank in advance.

    Hi
    In order to use a subquery in a condition there has to be an existing worksheet already in the workbook. If you don't have an existing worksheet then you will still see the Create Subquery option but you won't be able to use it.
    Here's a workflow to try it out using SYSDATE:
    1. First of all, make sure you open Desktop, not Plus.
    2. Create a new Table worksheet containing only a calculation, SYSDATE - you do this by continually clicking Next until you get to step 6 of the wizard, ignoring the message which says you have no items in the worksheet
    3. In step 6, click the New button
    4. Leave the calculation name as Calculation0 and add SYSDATE into the calculation
    5. Click the OK button
    6. Click the Finish button - you now have the current date in your worksheet
    7. From the menu bar, select Sheet | New Sheet and select Table
    8. Once again continually click Next until you get to step 6 of the wizard, ignoring the message which says you have no items in the worksheet
    9. In step 6, click the New button
    10. Leave the calculation name as Calculation1 and once again add SYSDATE into the calculation
    11. Click the OK button
    12. Click the Finish button - you now have the current date in your second worksheet
    13. Staying in the second worksheet, from the menu bar select Tools | Conditions
    14. Click the New button to create a new condition
    15. In Item use the drop-down and select Calculation1
    16. Under the drop-down for Value(s) you should see Create Subquery
    17. Notice how Discoverer has automatically selected Calculation0? This is the only item so naturally it will be selected. However, if you have more than one item Discoverer picks an item of the same data type
    18. Nothing more to do now except click the OK button a couple of times
    What you have done is said that the SYSDATE in worksheet2 is dependent upon the formula in sheet1 which happens to be also SYSDATE.
    To prove this working, go back into sheet1 and change the formula to SYSDATE -1, then go back to sheet 2 and refresh it. This time you should get no data returned showing that the subquery is working.
    By the way, any worksheets you create in Desktop that use subqueries will still work in Plus even though you cannot edit the subquery itself in Plus.
    Best wishes
    Michael

  • How to write the java program to retrieve the last 7 days dates

    Hi,
    I am having requirement that how to write the java program to retrieve the last 7 days dates. Please help me.
    Regards,
    Ahamad

    It needs any jar file.Of course!
    I did using jscape.My program is running fine.But it
    requires jar file.Which is licensed version.Maybe you should follow the link the the 'license' on the site I posted!
    >
    I have the doubt is apache provides jar file free
    versionMaybe you should follow the link the the 'license' on the site I posted!

Maybe you are looking for

  • Making a java program on network

    Hi, I am not an expert in java. So far all my small programs were for fun but now I am thinking of making a small CRM program to help my friend in his business. His office has two computers which are networked. So this small program which I am going

  • IMac 27" OS 10.6.2 and Windows 7

    I'm sure this has been beaten to death but, I could not find a definitive answer on the situation with Windows 7. Is it OK to install on a iMac 27" OS 10.6.2 Intel Core 2 Duo? Some has posted messages of black screen during install seemingly using th

  • Vim doesn't display correctly utf8 characters

    Hi, I don't use an utf8 locale, but some files (like latex sources of my reports) are in utf8 for compatibility with other pcs. Since a while, but i cannot recall exactly when (normally, I don't use vi for latex), it doesn't display correctly such fi

  • Installing third party application on Trusted Solaris 8

    Does anyone know of a procedure describing the steps necessary to install an application into /usr/local/ on Trusted Solaris 8. I've managed to get directories and files created under this by switching between admin_high and admin_low workspaces. How

  • More Distortion Questions

    I posted about this before but now realize I may have misdiagnosed the problem. I have a DV quicktime file that play perfectly. When brought into FCE 3.5.1 however, there's one scene that becomes very distorted. Tom Wolsky originally suggested it was