Pls help me to modify the query for performance improvement

Hi,
I have the below initialization
DECLARE @Active bit =1 ;
Declare @id int
SELECT @Active=CASE WHEN id=@id and [Rank] ='Good' then 0 else 1 END  FROM dbo.Students
I have to change this query in such a way that the conditions id=@id and [Rank] ='Good' should go to the where condition of the query. In that case, how can i use Case statement to retrieve 1 or 0? Can you please help me to modify this initialization?

I dont understand your query...May be below? or provide us sample data and your output...
SELECT *  FROM dbo.students
where @Active=CASE
WHEN id=@id and rank ='Good' then 0 else 1 END
But, I doubt you will have performance improvement here?
Do you have index on id?
If you are looking for getting the data for @ID with rank ='Good' then use the below:Make sure, you have index on id,rank combination.
SELECT *  FROM dbo.students
where  id=@id
and rank ='Good' 

Similar Messages

  • Need help in fixing the query for performance reasons

    hi
    I have a view in which I am calling a function to return some values I wand to get rid of the function and want to some how do all in the sql. Can I use case or something similar that will help me in avoiding the use of this function. Any help in this regard will highly be appreciated.
    Query
    SELECT SUBSTR(f_type_px17(ap.cidn,ap.currentstatusoid, 'DESC'), 1, 255)
                        from
                             px17_appointment ap,
                             /*context co_ap,*/
                             px17_payrollagreement pa,
                             px17_payrollgroup pg;
    FUNCTION
    CREATE OR REPLACE FUNCTION f_type_px17
    fv_cidn IN px17_type_client.cidn%TYPE,
    fv_oid IN px17_type_client.oid%TYPE,
    fv_col IN VARCHAR2 DEFAULT NULL
    ) RETURN VARCHAR2 AUTHID CURRENT_USER AS
    v_rtn_name px17_type_client.name%TYPE := NULL ;
    v_rtn_desc px17_type_client.description%TYPE := NULL ;
    BEGIN
    IF fv_oid IS NOT NULL THEN
    BEGIN
    IF UPPER(SUBSTR(fv_oid,1,3)) = 'SYS' THEN
    SELECT name, description
    INTO v_rtn_name, v_rtn_desc
    FROM px17_sys_type
    WHERE oid = fv_oid
    AND ROWNUM = 1 ;
    ELSE
    SELECT name, description
    INTO v_rtn_name, v_rtn_desc
    FROM px17_type_client
    WHERE oid = fv_oid
         AND cidn = fv_cidn
    AND ROWNUM = 1 ;
    END IF ;
    EXCEPTION
    WHEN no_data_found THEN
    v_rtn_name := NULL ;
    v_rtn_desc := NULL ;
    END ;
    END IF ;
    IF (UPPER(NVL(fv_col, '~')) = 'NAME') THEN
    RETURN v_rtn_name ;
    ELSIF ((UPPER(NVL(fv_col, '~')) = 'DESC')
    OR (UPPER(NVL(fv_col, '~')) = 'DESCRIPTION')) THEN
    RETURN v_rtn_desc ;
    ELSE
    RETURN (NVL(v_rtn_name, CHR(155)) || '~' || NVL(v_rtn_desc, CHR(155))) ;
    END IF ;
    END f_type_px17 ;
    /

    Well following is the whole code of a view and the functions releated, This will give you the whole picture and this query is running for long time.
    create or replace view PX17_CHK_VW_SUMMARY_VW
    (CIDN,BATCH_NUMBER, BUSINESS_UNIT, CHECK_VOUCHER_NUMBER, CHECK_VOUCHER_CODE, CHECKVIEW_CLOCK_NUMBER,
    COMPANY_CHECKVIEW_HOME_DEPT, PERIOD_END_DATE, FEDERAL_TAX, GROSS_PAY, HOME_DEPARTMENT,
    HOME_DEPARTMENT_DESC, LIVED_LOCAL_TAX_CODE, LIVED_STATE_TAX_CODE, LIVED_LOCAL_TAX, LIVED_STATE_TAX,
    MEDICARE_TAX, NET_PAY, DEPARTMENT_WORKED_IN, PAY_TO_COMPANY_INDICATOR, PAY_DATE,
    PAYROLL_NUMBER, SCHOOL_DISTRICT_TAX, CHECKVIEW_SCHOOL_DISTRICT, SOCIAL_SECURITY_TAX, SUI_SDI_TAX,
    SUI_SDI_TAX_CODE, VOID_CHECK_INDICATOR, WEEK_NUMBER, WORKED_LOCAL_TAX_CODE, WORKED_STATE_TAX_CODE,
    WORKED_LOCAL_TAX, WORKED_STATE_TAX, YEAR, COMPANY_CODE, FILE_NUMBER,
    FIRST_NAME, LAST_NAME, LAST_NAME_FIRST_NAME, SOCIAL_SECURITY_NUMBER, STATUS,
    OVERTIME_EARNINGS, OVERTIME_HOURS, REGULAR_EARNINGS, REGULAR_HOURS, VIEWPK,
    HOME_COST_NUMBER, TAX_FREQUENCY, COMPANY_COST_NUMBER, COST_NUMBER_WORKED_IN, DISTRIBUTION_NUMBER,
    TOTAL_DEDUCTIONS_AMOUNT, TOTAL_HOURS_AMOUNT, TOTAL_MEMO_AMOUNT, TOTAL_OTHER_EARNINGS, TOTAL_OTHER_HOURS,
    CHECK_SEQ_NO, JOINKEY, CHECK_REVERSAL_INDICATOR
    as
    with user_security_homedept
    AS
    (select /*+ INLINE */ distinct cg.cidn,co_code,asso.oid,asso.name,department_Access ,t2.column_value dep,cg.oid
    from px17_cocodegroup cg ,
    px17_associate asso ,
         px17_securityobject so,
         px17_cocodegrp_securitygrp cs,
         px17_security_group sg ,
         TABLE(f_str2tbl_px17(cg.department_access)) t2
    where cg.USEROID = asso.OID
    and cg.co_code = substr(so.name,8,3)
    and upper(asso.name) = upper(sys_context('payx_r17_app_context', 'app_userid'))
    and cg.oid = cs.cocodegroupoid
    and cs.securitygroupoid = sg.oid
         and cg.cidn = asso.cidn
         and cg.cidn = so.cidn
         and cg.cidn = cs.cidn
         and cs.cidn = sg.cidn
    order by 2,1
    user_security_cost_no
    AS
    (select /*+ INLINE */
    cg.cidn,co_code,count(distinct cd.code)cost_no,cd.code
    from px17_cocodegroup cg ,
    px17_associate asso ,
         px17_securityobject so,
         px17_cocodegrp_securitygrp cs,
         px17_security_group sg ,
         px17_customaccessdetail cd
    where cg.USEROID = asso.OID
    and cg.co_code = substr(so.name,8,3)
    and upper(asso.name) = upper(sys_context('payx_r17_app_context', 'app_userid'))
    and cg.oid = cs.cocodegroupoid
    and cs.securitygroupoid = sg.oid
    and cg.oid = cd.cocodegroupoid(+)
         and cg.cidn = cd.cidn(+)
         and cg.cidn = asso.cidn
         and cg.cidn = so.cidn
         and cg.cidn = cs.cidn
         and cs.cidn = sg.cidn
    group by cg.cidn,co_code,cd.code
    order by 2,1
    super_user_check as
    (SELECT
    distinct a.cidn su_cidn,1 as su_user
    FROM
    px17_LINK LN
    , px17_userprofile up
    , px17_ASSOCIATE a
    , px17_pcp_user pu
    WHERE
    a.oid = pu.oid
    AND pu.userprofileoid = up.oid
    AND LN.parentoid = up.oid
    AND a.active = 1
    AND a.cidn=pu.cidn
    AND pu.cidn=up.cidn
    AND ln.cidn=up.cidn
    AND upper(a.name) = upper(sys_context('payx_r17_app_context', 'app_userid'))
    AND upper(up.name) = upper('Super user')
    nonsuper_user_check as
    SELECT distinct a.cidn s_cidn , 1 as non_user
    FROM
    px17_LINK LN
    , px17_userprofile up
    , px17_ASSOCIATE a
    , px17_pcp_user pu
    WHERE
    a.oid = pu.oid
    AND pu.userprofileoid = up.oid
    AND LN.parentoid = up.oid
    AND a.active = 1
    AND a.cidn=pu.cidn
    AND pu.cidn=up.cidn
    AND ln.cidn=up.cidn
    AND upper(a.name) = upper(sys_context('payx_r17_app_context', 'app_userid'))
         AND LN.childoid IN ( 'SYS:5:7478')
    SELECT distinct
    cidn
         ,batch_number     Batch_Number
         , business_unit     Business_Unit
         , check_voucher_number     Check_Voucher_Number
         , check_voucher_code     Check_Voucher_Code
         , clock_number     CheckView_Clock_Number
         , company_code_or_dept     Company_CheckView_Home_Dept
         , period_end_date     Period_End_Date
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, 1, (INSTR(taxes_and_rates, '~', 1, 1) -1)), CHR(155), NULL))     Federal_Tax
         , gross_pay     Gross_Pay
         , home_department     Home_Department
         , home_department_descr     Home_Department_Desc
         , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 1) +1)
                   , INSTR(taxes_and_rates, '~', 1, 2) - (INSTR(taxes_and_rates, '~', 1, 1) +1)), CHR(155), NULL), 1, 32)     Lived_Local_Tax_Code
         , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 2) +1)
                   , INSTR(taxes_and_rates, '~', 1, 3) - (INSTR(taxes_and_rates, '~', 1, 2) +1)), CHR(155), NULL), 1, 32)     Lived_State_Tax_Code
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 3) +1)
                   , INSTR(taxes_and_rates, '~', 1, 4) - (INSTR(taxes_and_rates, '~', 1, 3) +1)), CHR(155), NULL))     Lived_Local_Tax
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 4) +1)
                   , INSTR(taxes_and_rates, '~', 1, 5) - (INSTR(taxes_and_rates, '~', 1, 4) +1)), CHR(155), NULL))     Lived_State_Tax
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 5) +1)
                   , INSTR(taxes_and_rates, '~', 1, 6) - (INSTR(taxes_and_rates, '~', 1, 5) +1)), CHR(155), NULL))     Medicare_Tax
         , net_pay     Net_Pay
         , department_paid     Department_Worked_In
         , to_pay_indicator     Pay_to_Company_Indicator
         , pay_date     Pay_Date
         , payroll_number     Payroll_Number
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 6) +1)
                   , INSTR(taxes_and_rates, '~', 1, 7) - (INSTR(taxes_and_rates, '~', 1, 6) +1)), CHR(155), NULL))     School_District_Tax
         , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 7) +1)
                   , INSTR(taxes_and_rates, '~', 1, 8) - (INSTR(taxes_and_rates, '~', 1, 7) +1)), CHR(155), NULL), 1, 32) CheckView_School_District
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 8) +1)
                   , INSTR(taxes_and_rates, '~', 1, 9) - (INSTR(taxes_and_rates, '~', 1, 8) +1)), CHR(155), NULL))     Social_Security_Tax
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 9) +1)
                   , INSTR(taxes_and_rates, '~', 1, 10) - (INSTR(taxes_and_rates, '~', 1, 9) +1)), CHR(155), NULL))     SUI_SDI_Tax
         , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 10) +1)
                   , INSTR(taxes_and_rates, '~', 1, 11) - (INSTR(taxes_and_rates, '~', 1, 10) +1)), CHR(155), NULL), 1, 32) SUI_SDI_Tax_Code
         , void_check_indicator     Void_Check_Indicator
         , week_number     Week_Number
         , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 11) +1)
                   , INSTR(taxes_and_rates, '~', 1, 12) - (INSTR(taxes_and_rates, '~', 1, 11) +1)), CHR(155), NULL), 1, 32) Worked_Local_Tax_Code
         , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 12) +1)
                   , INSTR(taxes_and_rates, '~', 1, 13) - (INSTR(taxes_and_rates, '~', 1, 12) +1)), CHR(155), NULL), 1, 32) Worked_State_Tax_Code
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 13) +1)
                   , INSTR(taxes_and_rates, '~', 1, 14) - (INSTR(taxes_and_rates, '~', 1, 13) +1)), CHR(155), NULL))     Worked_Local_Tax
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 14) +1)
                   , INSTR(taxes_and_rates, '~', 1, 15) - (INSTR(taxes_and_rates, '~', 1, 14) +1)), CHR(155), NULL))     Worked_State_Tax
         , year          Year
         , company_code     Company_Code
         , file_number     File_Number
         , first_name     First_Name
         , last_name          Last_Name
         , name          Last_Name_First_Name
         , ssn               Social_Security_Number
         , status          Status
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 15) +1)
                   , INSTR(taxes_and_rates, '~', 1, 16) - (INSTR(taxes_and_rates, '~', 1, 15) +1)), CHR(155), NULL))     Overtime_Earnings
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 16) +1)
                   , INSTR(taxes_and_rates, '~', 1, 17) - (INSTR(taxes_and_rates, '~', 1, 16) +1)), CHR(155), NULL))     Overtime_Hours
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 17) +1)
                   , INSTR(taxes_and_rates, '~', 1, 18) - (INSTR(taxes_and_rates, '~', 1, 17) +1)), CHR(155), NULL))     Regular_Earnings
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 18) +1)
                   , INSTR(taxes_and_rates, '~', 1, 19) - (INSTR(taxes_and_rates, '~', 1, 18) +1)), CHR(155), NULL))     Regular_Hours
         , (company_code || '/' || ssn || '/' || file_number || '/' || TO_CHAR(payroll_number) || '/'
              || TO_CHAR(year) || '/' || TO_CHAR(week_number) || '/' || check_voucher_number
              || '/' || to_char(check_seq_num) || '/' || TO_CHAR(distribution_number)) Viewpk
         , home_costnumber_desc Home_Cost_Number
         , tax_frequency Tax_Frequency
         , co_chkv_home_cost_no Company_Cost_Number
         , cost_no_worked_in Cost_Number_Worked_In
         , distribution_number Distribution_Number
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 19) +1)
                   , INSTR(taxes_and_rates, '~', 1, 20) - (INSTR(taxes_and_rates, '~', 1, 19) +1)), CHR(155), NULL))     Total_Deductions_Amount
         , NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 20) +1)
                   , INSTR(taxes_and_rates, '~', 1, 21) - (INSTR(taxes_and_rates, '~', 1, 20) +1)), CHR(155), NULL)), 0) Total_Hours_Amount
         , NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 21) +1)
                   , INSTR(taxes_and_rates, '~', 1, 22) - (INSTR(taxes_and_rates, '~', 1, 21) +1)), CHR(155), NULL)), 0) Total_Memo_Amount
         , NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 22) +1)
                   , INSTR(taxes_and_rates, '~', 1, 23) - (INSTR(taxes_and_rates, '~', 1, 22) +1)), CHR(155), NULL)), 0) Total_Other_Earnings
         , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 23) +1)), CHR(155), NULL))     Total_Other_Hours
         , check_seq_num Check_Seq_No
         , (NVL(company_code, '~') || CHR(155) || NVL(file_number, '~') || CHR(155) || NVL(ssn, '~') || CHR(155) || NVL(TO_CHAR(year), '~') || CHR(155)
              || NVL(TO_CHAR(week_number), '~') || CHR(155) || NVL(TO_CHAR(payroll_number), '~')
              || CHR(155) || NVL(check_voucher_number, '~') || CHR(155) || NVL(TO_CHAR(check_seq_num), '~') || CHR(155) || NVL(TO_CHAR(distribution_number), '~')) Joinkey
         , chk_reverse Check_Reversal_Indicator
    FROM
              SELECT
              ch.cidn cidn
                   /*BATCH NUMBER*/
                   , ch.batch_nb     batch_number
                   , /*BUSINESS UNIT*/
                   (select asso.description
                        from     px17_appointment ap,
                             px17_jobposition jp,
                             px17_corporation co,
                             px17_associate asso,
                             px17_payrollagreement pa,
                             px17_payrollgroup pg
                        where
                        ch.cidn = pg.cidn
                                       AND ch.cidn = pa.cidn
                                       AND pa.cidn = pg.cidn
                                       AND pa.cidn = ap.cidn
                                       AND em.cidn = ap.cidn
                                       AND ap.cidn = jp.cidn
                                       and jp.cidn = co.cidn
                                       and co.cidn = asso.cidn
                        and ch.co_code=pg.co_code
                        and     ch.file_nb=pa.file_number
                        and     pa.cocodeoid=pg.oid
                        and     pa.appointmentoid=ap.oid
                        and     em.oid=ap.employmentoid
                        and     ap.jobpositionoid=jp.oid
                             and     jp.corporationoid=co.oid
                        and     co.oid=asso.oid)     business_unit
                   , /*CHECK/VOUCHER NUMBER*/
                   ch.check_nb     check_voucher_number
                   , /*CHECK/VOUCHER CODE*/
                   SUBSTR(f_type_px17(ch.cidn,ch.chkvchcodeoid, 'NAME'), 1, 255) check_voucher_code
                   , /*CLOCK NUMBER*/
                   ch.clock_id     clock_number
                   , /* COMPANY CODE OR DEPT*/
                   ch.co_code||'/'||substr(ch.home_dept_code,1,20)     company_code_or_dept
                   , /*PERIOD END DATE*/
                   ch.payroll_ending_date     period_end_date
                   , /*GROSS PAY*/
                   NVL(chd.gross_pay_amt,0)     gross_pay
                   , /*HOME DEPARTMENT*/
                   ch.home_dept_code     home_department
                   , /*HOME DEPARTMENT DESCRIPTION*/
                   (select     ty.description
                        from     px17_type ty,px17_securityobject sc
                        where
                        ch.cidn = sc.cidn     
                        and ty.cidn in ('COMMON', ch.cidn)
                        and ch.home_dept_code=ty.name
                        and     ty.category='T_CO_DEPT'
                        and      ty.securityoid=sc.oid
                        and     ch.co_code=substr(sc.name,8))     home_department_descr
                   , /*NET PAY*/
                   nvl(chd.net_pay_amt,0)     net_pay
                   , /*DEPARTMENT PAID*/
                   -- ch.paid_in_debt_code     department_paid
                   chd.worked_in_dept     department_paid
                   , /*TO PAY INDICATOR*/
                   decode(to_char(ch.pay_to_co),'1','Y','0','N',to_char(ch.pay_to_co))     to_pay_indicator
                   , /*PAY DATE*/
                   ch.pay_date     pay_date
                   , /*PAYROLL NUMBER*/
                   to_char(ch.payroll_nb)     payroll_number
                   , /*VOID CHECK INDICATOR*/
                   decode(to_char(ch.void_flag),'1','Y','0','N',to_char(ch.void_flag))     void_check_indicator
                   , /*WEEK NUMBER*/
                   TO_number(ch.week)     week_number
                   , /*YEAR*/
                        to_char(ch.year)     year
                   , /*COMPANY CODE*/
                   ch.co_code     company_code
                   , /*FILE NUMBER*/
                   LPAD(ch.file_nb,6,0)     file_number
                   , /*FIRST NAME*/
                   pe.first_name     first_name
                   , /*LAST NAME*/
                   pe.last_name     last_name
                   , /*NAME*/
                   pe.last_name||', '||pe.first_name     name
                   , /*SSN*/
                   payx_r17_principal_info.masked_ssn(pe.unique_id, ch.cidn)      ssn
                   , /*STATUS*/
                   (SELECT SUBSTR(f_type_px17(ap.cidn,ap.currentstatusoid, 'DESC'), 1, 255)
                        from
                             px17_appointment ap,
                             /*context co_ap,*/
                             px17_payrollagreement pa,
                             px17_payrollgroup pg
                        where     
                        pg.cidn=ch.cidn
                             and pa.cidn=ch.cidn
                                  and ap.cidn=pa.cidn
                                  and ap.cidn = em.cidn
                        and ap.employmentoid=em.oid
                        and     ap.active=1
                        and     ap.oid=pa.appointmentoid
                        and     lpad(to_char(pa.file_number),6,0)=ch.file_nb
                        and     pa.cocodeoid=pg.oid
                        and     pg.co_code=ch.co_code)     status
                   --          FED TAX
                   --          , LIVED LOCAL TAX CODE, LIVED STATE TAX CODE, LIVED LOCAL TAX, LIVED STATE TAX, MEDICARE TAX
                   --          , SCHOOL DISTRICT TAX, SCHOOL DISTRICT, SOCIAL SECURITY TAX, SUI SDI TAX, SUI SDI TAX CODE
                   --          , WORKED LOCAL TAX CODE, WORKED STATE TAX CODE, WORKED LOCAL TAX, WORKED STATE TAX
                   --          , OVERTIME EARNINGS, OVERTIME HOURS, REGULAR EARNINGS, REGULAR HOURS
                   NVL (
                        (SELECT
                             TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2982', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2984', ci.code, NULL), NULL)), CHR(155)) || '~'
                             || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2987', DECODE(ci.code,'XX',null,ci.code), NULL), NULL)), CHR(155)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2984', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2987', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4118', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4114', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4114', ci.code, NULL), NULL)), CHR(155)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2988', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2989', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2989', ci.code, NULL), NULL)), CHR(155)) || '~'
                             || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2983', ci.code, NULL), NULL)), CHR(155)) || '~'
                             || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2986', ci.code, NULL), NULL)), CHR(155)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2983', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2986', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3713', NVL(ci.amount,0), 0)), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3727', NVL(ci.amount,0), 0)), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3715', NVL(ci.amount,0), 0)), 0)) || '~'
                             || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3716', NVL(ci.amount,0), 0)), 0)) || '~'
                             -- R16 columns.
                             -- Total Deductions Amount === Other Deductions on UI screen.
                             || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'DeductionHistory'
                                  , DECODE(NVL(ci.statutory_ded, 0), 0
                                       , DECODE(ci.taxcodeoid, NULL
                                            , DECODE(ci.code, NULL, 0, NVL(ci.amount,0)), 0), 0), 0)), 0)) || '~' -- "Total Deductions Amount"
                             || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'OvertimeHours', NVL(ci.amount,0)
                                  , 'AdditionalHours', NVL(ci.amount,0), 'RegularHours', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Hours Amount"
                             || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'Memo', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Memo Amount"
                             || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'AdditionalEarnings', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Other Earnings"
                             || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'AdditionalHours', NVL(ci.amount,0), 0)), 0)) -- "Total Other Hours"
                        FROM
                             px17_checkhistoryitem ci
                             , px17_sys_type chcat
                        WHERE
                        ci.cidn=chd.cidn
                             AND ci.checkhistorydistributionoid = chd.oid
                             AND chcat.category = 'CheckHistoryItem'
                             AND chcat.oid = ci.histtypeoid
                             -- AND ci.histtypeoid IN ('SYS:4:3713', 'SYS:4:3727', 'SYS:4:3715', 'SYS:4:3716', 'SYS:4:3709')
                        ), '0' || '~' || CHR(155) || '~' || CHR(155)
                             || '0~0~0~0~' || CHR(155) || '~0~0~' || CHR(155) || '~' || CHR(155) || '~'
                             || CHR(155) || '~0~0~0~0~0~0'
                        )     taxes_and_rates
                   , ch.check_seq_num check_seq_num
                   , ch.home_cost_number home_costnumber_desc
                   , SUBSTR(f_type_px17(ch.cidn,ch.payfrequencyoid, 'NAME'), 1, 255) tax_frequency
                   , (ch.co_code || '/' || ch.home_cost_number) co_chkv_home_cost_no
                   , chd.worked_in_cost_number cost_no_worked_in
                   , chd.distribution_number distribution_number
                   , DECODE(NVL(ch.reversed_flag, 0), 1, 'Y', 'N') chk_reverse
              FROM
                   px17_checkhistory ch
                   , px17_employment em
                   , px17_person pe
                   , px17_payrollgroup pg
                   , px17_checkhistory_dist chd
                   , px17_appointment ap
              WHERE
              ch.cidn = em.cidn
              and em.cidn = pe.cidn
              and pg.cidn = ch.cidn
              and ch.cidn = chd.cidn
              and ap.cidn(+) = em.cidn
                   and ch.employmentoid=em.oid
                   AND     em.personoid=pe.oid
                   AND     pg.co_code = ch.co_code
                   AND ch.active = 1
                   AND ch.oid = chd.checkhistoryoid
                   AND ap.employmentoid(+) = em.oid
                   AND DECODE(ap.oid, NULL, 1, NVL((SELECT 1 FROM px17_payrollagreement pa
                                  WHERE
                                  pa.cidn = ap.cidn
                                  and pa.cidn = ch.cidn
                                  and pa.cidn = pg.cidn
                                  and pa.appointmentoid = ap.oid
                                       AND pa.file_number = ch.file_nb
                                       AND pa.cocodeoid = pg.oid), 0)) = 1
                                       and ch.cidn in (select distinct s_cidn from nonsuper_user_check)
                                       AND ( sys_context('payx_r17_app_context', 'app_role') in ('ADP', 'CSR')
              or (exists (select 1 from super_user_check where su_cidn =ch.cidn))
              or (ch.cidn,ch.co_code,ch.home_dept_code) in (select cidn,co_code,dep from user_security_homedept)          
              or (ch.cidn,ch.co_code,ch.home_cost_number) in (select cidn,co_code,code from user_security_cost_no)
                   or ( exists(select co_code from user_security_homedept where cidn=ch.cidn and co_code = ch.co_code and dep is null)
                   and exists(select co_code from user_security_cost_no where cidn=ch.cidn and co_code = ch.co_code and cost_no = 0) )
    Following are the functions being called:
    create or replace type myTable_17 as table of varchar2(4000);
    CREATE OR REPLACE function f_str2tbl_px17( p_str in varchar2 ) return myTable_17 pipelined
    as
    l_str long default p_str || ',';
    l_n number;
    begin
    loop
    l_n := instr( l_str, ',' );
    exit when (nvl(l_n,0) = 0);
    pipe row( ltrim(rtrim(substr(l_str,1,l_n-1))) );
    l_str := ltrim( substr( l_str, l_n+1 ) );
    end loop;
    return;
    end f_str2tbl_px17;
    CREATE OR REPLACE FUNCTION f_check_purge_px17
              fv_cidn px17_reservedfilenumber.cidn%TYPE,     
              fv_file_number     px17_reservedfilenumber.file_number%TYPE,
              fv_cocode     px17_payrollgroup.co_code%TYPE DEFAULT NULL
         ) RETURN NUMBER AUTHID CURRENT_USER
    AS
         v_val     NUMBER(5) ;
    BEGIN
         IF fv_cocode IS NULL THEN
              RETURN 0 ;
         END IF ;
         SELECT 1 INTO v_val
         FROM px17_reservedfilenumber a,
    px17_payrollgroup b
         WHERE
         a.cidn = fv_cidn
         AND b.cidn = fv_cidn
         AND a.file_number = fv_file_number
         AND a.parentoid = b.oid
    AND b.co_code = fv_cocode
         AND ROWNUM = 1 ;
         RETURN 1 ;
    EXCEPTION
         WHEN no_data_found THEN
              RETURN 0 ;
    END f_check_purge_px17 ;
    CREATE OR REPLACE FUNCTION f_check_security_px17
         fv_cidn IN px17_type_client.cidn%TYPE,
              fv_cocode          px17_cocodegroup.co_code%TYPE -- pg.cocode
              , fv_home_dept     px17_type_client.name%TYPE -- ap.home_dept
         ) RETURN NUMBER AUTHID CURRENT_USER
    AS
         v_val     NUMBER(5) ;
         v_key          VARCHAR2(20) ;
         v_users     VARCHAR2(4000) ;
         v_cocodes     VARCHAR2(4000) ;
    BEGIN
         BEGIN
              SELECT c_user_list, c_cocodes, c_run_key
              INTO v_users, v_cocodes, v_key
              FROM px17_t_context_vals
              WHERE c_run_key = (SELECT MAX(c_run_key) FROM px17_t_context_vals)
                   AND ROWNUM = 1 ;
         EXCEPTION
              WHEN no_data_found THEN
                   v_cocodes := NULL ;
         END ;
         IF v_cocodes IS NULL THEN
              RETURN 1 ;
         ELSIF INSTR( (v_cocodes || ','), (fv_cocode || ',') ) = 0 THEN
              RETURN 0 ;
         ELSE
              BEGIN
                   SELECT
                        1
                   INTO
                        v_val
                   FROM
                        px17_type_client t
                        , px17_securityobject s
                        , px17_cocodegroup c
                   WHERE
                        t.securityoid=s.oid
                        AND t.category='T_CO_DEPT'
                        AND c.useroid=(SELECT a.oid
                                       FROM px17_associate a
                                       WHERE a.oid = c.useroid
                                            AND a.active=1
                                            AND UPPER(a.name) = UPPER(v_users)
                                            AND ROWNUM = 1)
                        AND SUBSTR(s.name,8,3)=c.co_code
                        AND (c.department_access IS NULL
                             OR c.department_access LIKE '%' || t.name || '%')
                        AND SUBSTR(s.name,8,3) = fv_cocode
                        AND t.name = fv_home_dept
                        AND ROWNUM = 1 ;
                        RETURN 1 ;
              EXCEPTION
                   WHEN no_data_found THEN
                        BEGIN
                             SELECT
                                  1
                             INTO
                                  v_val
                             FROM
                                  px17_cocodegroup c
                                  , px17_associate a
                             WHERE
                                  c.useroid=a.oid
                                  AND c.department_access IS NULL
                                  AND c.co_code = fv_cocode
                                  AND UPPER(a.name)= UPPER(v_users)
                                  AND a.active=1
                                  AND ROWNUM = 1 ;
                             RETURN 1 ;
                        EXCEPTION
                             WHEN no_data_found THEN
                                  RETURN 0 ;
                        END ;
              END ;
         END IF ;
         RETURN 0 ;
    END f_check_security_px17 ;
    SELECT SUBSTR(f_type_px17(ap.cidn,ap.currentstatusoid, 'DESC'), 1, 255)
                        from
                             px17_appointment ap,
                             /*context co_ap,*/
                             px17_payrollagreement pa,
                             px17_payrollgroup pg
    CREATE OR REPLACE FUNCTION f_type_px17
    fv_cidn IN px17_type_client.cidn%TYPE,
    fv_oid IN px17_type_client.oid%TYPE,
    fv_col IN VARCHAR2 DEFAULT NULL
    ) RETURN VARCHAR2 AUTHID CURRENT_USER AS
    v_rtn_name px17_type_client.name%TYPE := NULL ;
    v_rtn_desc px17_type_client.description%TYPE := NULL ;
    BEGIN
    IF fv_oid IS NOT NULL THEN
    BEGIN
    IF UPPER(SUBSTR(fv_oid,1,3)) = 'SYS' THEN
    SELECT name, description
    INTO v_rtn_name, v_rtn_desc
    FROM px17_sys_type
    WHERE oid = fv_oid
    AND ROWNUM = 1 ;
    ELSE
    SELECT name, description
    INTO v_rtn_name, v_rtn_desc
    FROM px17_type_client
    WHERE oid = fv_oid
         AND cidn = fv_cidn
    AND ROWNUM = 1 ;
    END IF ;
    EXCEPTION
    WHEN no_data_found THEN
    v_rtn_name := NULL ;
    v_rtn_desc := NULL ;
    END ;
    END IF ;
    IF (UPPER(NVL(fv_col, '~')) = 'NAME') THEN
    RETURN v_rtn_name ;
    ELSIF ((UPPER(NVL(fv_col, '~')) = 'DESC')
    OR (UPPER(NVL(fv_col, '~')) = 'DESCRIPTION')) THEN
    RETURN v_rtn_desc ;
    ELSE
    RETURN (NVL(v_rtn_name, CHR(155)) || '~' || NVL(v_rtn_desc, CHR(155))) ;
    END IF ;
    END f_type_px17 ;
    *************************

  • Pls help me in writing a query for my problem !

    I have to find out the amount(LAmt) for members who lie btw diff age groups, below are the table structures:
    table1
    DOB ID
    12/24/1986 F125
    06/05/1988 F223
    05/04/1987 F589
    07/07/2001 F856
    table2
    LAmt ID LDate
    $56 F125 01/01/2011
    $45 F223 08/22/2005
    $87 F589 09/24/2004
    $87 F856 10/10/2000
    $87 F587 09/09/2002
    Query:
    1) I have to find the age group for the members who lie between 1 to 5 & 6 to 10 and so on, Also find the the no. of days since they have been registered(Using LDate-Current Date) , also the LAmt for those members.

    Hi,
    836810 wrote:
    SELECT -- To calculate Listed Amount of members btw age group 0 to 4
    COUNT(DateOfBirth) as Nopresent,
    DATEDIFF (yyyy,DateOfBirth,GETDATE()) as age,
    SUM(RPTInvHosp.AccountListAmount) as ListedAmt,
    COUNT(DateOfBirth) * SUM(RPTInvHosp.AccountListAmount) as [Calc]
    FROM RPTInv1st,RPTInvHosp
    WHERE
    DATEDIFF (yyyy,DateOfBirth,GETDATE()) >= 0 and
    DATEDIFF (yyyy,DateOfBirth,GETDATE()) < 5 and
    RPTInv1st.PASDebtorID=RPTInvHosp.PASDebtorID
    Group by DATEDIFF (yyyy,DateOfBirth,GETDATE())
    I want to get members btw the particular age group JOIN with the no of days they have been opened an account & their amount.In Oracle, use double-quotes (or nothing) instead of square brackets around aliases:
    COUNT(DateOfBirth) * SUM(RPTInvHosp.AccountListAmount)  as "Calc"The double-quotes are only necessary if you want the alias not to conform to the normal naming conventions; they are optional around normal names, such as CALC.
    There are no built-in functions called GETDATE or DATEDIFF in Oracle.
    In Oracle, SYSDATE returns the current DATE (on the database server).
    There's nothing very convenient in Oracle for getting the difference between two DATEs in units of a year. The best way is to use MONTHS_BETWEEN to get the difference in months, and then divide that number by 12, like this:
    WHERE     FLOOR ( MONTHS_BETWEEN ( SYSDATE
                                , DateOfBirth
               / 12
               )          BETWEEN     0
                         AND     4Do you need help about how to do a join?
    It's not at all clear what you want here.
    Whenever you have a question, post CREATE TABLE and INSERT statements for your sample data, and post the exact results you want from that data. Explain, with specific examples, how you get those results from that data.
    Always say what version of Oracle (or other software) you're using.

  • Hi, i installed ios 5 for my iphone 4 and the camera function on lock screen was on the first few days , now it doesn't show the lock screen . is there any change i can do . Pls help me to solve the issue.

    hi, i installed ios 5 for my iphone 4 and the camera function on lock screen was on the first few days , now it doesn't show the lock screen . is there any change i can do . Pls help me to solve the issue.

    nishaadp wrote:
    ... it stucks with the apple logo ,  nothing works. Is anything i can do?
    See Here for
    Frozen or unresponsive iPhone

  • Pls help me in sending sequential responses for the different commands.

    Hi all
    pls help me in  sending sequential responses for the different commands. For example,i have to send the response1 for command1 then again host wll send the some other command ,say command 2  after receiving response 1,then again i have to respond to the corresponding command.i m using the pci-6221 card not tradition DAQcard.
    regards,
    nitin

    Hi,
    you need to be more specific. What is your setup?
    Obviously, what you need is a command parser. Look this article for the basics. I know it is meant for RT but the concept is there.
    Not sure it will help with so few infos: http://zone.ni.com/devzone/conceptd.nsf/webmain/CD63FD0F746B17A686256F090065F572
    Dai
    Dai
    LV 7.1 - WIN XP - RT - FP

  • What will be the query for the below stated problem..??

    Dear Sir
    I want that in Incoming payment after selecting a Customer when we right click and select payment means under checks tab the bank details of that customer should be there i.e. According to Bank Code its Branch and Account no be shown with the help of a query. If anyone knows the query for this please let me know...

    Hello jyotasna ,
    Let me try explain
    SAP Process :-
    When you make incoming payment with Cheque or bank then this is not complete sale cycle.
    Bank Offset Account      Debit
    Customer Account          Credit
    You should make deposit(Banking>Incoming Payment>Deposit) for which you have made incoming payment.and here we put all info for bank account
    Bank Account  Debit
    Bank Offset account Credit
    Why :-
    Suppose your client said that he deposit your cheque in bank in this date but due same bake issue or cheque issue the same cheque deposited in next day.
    In this senario if i made this entry in SAP then we need to modify it  based on Bank Reconciliation Statement(BRS)
    We also have bank reconciliation set for same
    Is there any confusion ?
    Thanks
    Manvendra Singh Niranjan
    Edited by: Manvendra Singh Niranjan on Jul 13, 2011 1:10 PM

  • Need to install only the query for fi account receivables standard data ?

    Hi all,
    I need to insall only the query for the standard business content for fi_ar in bw 3.5 ?
    i have selected the cube and then in grouping i have selected data flow afterwards only.
    And i have selected the queries only. but the cube is selected again. Should i uncheck the cube and install only the queries and transport it?
    Pls guide me on this!!
    Thanks
    Pooja

    Hi,
    If the required cube is already avaialble and continue with the existing design, you can uncheck the cube and install only queries. Check all the prerequisites before installing queries like used infoobjects, other targets if any.
    Hope this helps,
    Regards,
    Rama Murthy.

  • VO Extension Error in modifying the query of XML Publisher Report Template

    Hi Friends,
    I have one requirement related to calling XML Publisher Reports Template from OAF Page.
    When clicking on the submit button the XML Publisher template is calling and displaying the data.
    Our requirement is to display some more columns in the XML Publisher Template and display the data.
    As according to OAF stndards,whenever we need to add new columns for display or SELECT purpose,
    we will do the VO Extension. So we modified the query by adding the new additional colums in the standard VO.
    I am able to retrieve the data from the SQL DEVELOPER. But when doing the VO Extension process and
    calling the template from the OAF page its throwing the following error.Please suggest me some alternatives
    to fix the issue.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT
    DECODE(ASO_QUOTES.RESOURCE_ID, null, sales.name, sales1.name) sales_rep_name,
    aso_quotes.quote_name,
    aso_quotes.contract_id,
    aso_quotes.quote_number||decode(aso_quotes.quote_version,NULL,'',' - ') || aso_quotes.quote_version quote_name_version,
    to_char(aso_quotes.quote_expiration_date, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) quote_expiration_date,
    TO_NUMBER(TO_CHAR(aso_quotes.quote_expiration_date,'J')) - TO_NUMBER(TO_CHAR(Sysdate,'J')) duration,
    I_HEADER_CONTACT_PARTY.PARTY_NAME sold_to_contact_name,
    I_CUST_PARTIES.party_name customer_name,
    I_PHONE.PHONE_AREA_CODE || DECODE(I_PHONE.PHONE_AREA_CODE , NULL, '',' ' ) || I_PHONE.PHONE_NUMBER full_phone_number,
    I_INVOICE_REL_PARTY.PARTY_NAME invoice_to_contact_name,
    I_ACCTS_INV_PARTY.PARTY_NAME invoice_to_cust_party_name,
    I_INVOICE_LOCATIONS.ADDRESS1 invoice_to_address1,
    I_INVOICE_LOCATIONS.ADDRESS2 invoice_to_address2,
    I_INVOICE_LOCATIONS.ADDRESS3 invoice_to_address3,
    I_INVOICE_LOCATIONS.ADDRESS4 invoice_to_address4,
    decode(I_INVOICE_LOCATIONS.city, null,'',I_INVOICE_LOCATIONS.city || decode(I_INVOICE_LOCATIONS.county,null,'',',' || I_INVOICE_LOCATIONS.county)) invoice_to_city,
    I_INVOICE_LOCATIONS.state || decode(I_INVOICE_LOCATIONS.postal_code, null,'',' '||
    I_INVOICE_LOCATIONS.postal_code || decode(I_INVOICE_LOCATIONS.province,null,'',',' ||I_INVOICE_LOCATIONS.province )) invoice_to_county,
    I_INVOICE_LOCATIONS.country invoice_to_country,
    aso_quotes.currency_code Currency_Code,
    (select distinct ppf.email_address
    from per_people_f ppf,
    JTF_RS_SALESREPS jrs
    where jrs.resource_id = aso_quotes.resource_id
    and jrs.PERSON_ID = ppf.person_id
    and ppf.person_type_id = 3
    ) Sales_Rep_Email,
    aso_quotes.quote_header_id, oav.name||decode(oav.agreement_num,NULL,'',',')||oav.agreement_num||decode(oav.agreement_num,NULL,'',',')||oav.revision Agreement_name,
    oav.name||oav.agreement_num||oav.revision Agreement_check,
    to_char(oav.revision_date, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) revision_date,
    (select payment_term_name
    FROM
    aso_payments_v
    WHERE
    quote_line_id is null and
    quote_header_id = aso_quotes.quote_header_id) payment_terms,
    to_char(sysdate, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) curr_date,
    aso_quotes.total_list_price total_list_price,
    aso_quotes.total_adjusted_amount total_adjusted_amount,
    (aso_quotes.total_list_price + aso_quotes.total_adjusted_amount) total_net_price,
    aso_quotes.total_shipping_charge charges_total,
    aso_quotes.total_tax taxes_total,
    aso_quotes.total_quote_price total_quote_price,
    (select cust_po_number
    FROM
    aso_payments
    WHERE
    quote_line_id is null and
    quote_header_id = aso_quotes.quote_header_id ) cust_po_number,
    (select fct.name
    from fnd_currencies_tl fct
    where aso_quotes.currency_code = fct.currency_code
    and fct.language = userenv('lang')) Currency_Name,
    (select fcurr.symbol
    from fnd_currencies fcurr
    where aso_quotes.currency_code = fcurr.currency_code) Currency_Symbol,
    (Select meaning
    From oe_lookups
    Where lookup_type = 'FREIGHT_TERMS'
    And lookup_code = (select aship.freight_terms_code
    from aso_shipments aship
    where aship.quote_header_id = aso_quotes.quote_header_id
    and aship.quote_line_id is null)) Freight_Terms,
    (Select fl.meaning
    From fnd_lookup_values fl
    where fl.lookup_type = 'SHIP_METHOD'
    And fl.lookup_code = (select aship.ship_method_code
    from aso_shipments aship
    where aship.quote_header_id = aso_quotes.quote_header_id
    and aship.quote_line_id is null)
    And fl.language = userenv('LANG')) shipping_method ,
    aso_quotes.org_id ,
    aso_quotes.quote_number ,
    aso_quotes.Quote_version VersionNumber,
    I_ACCTS.ACCOUNT_NUMBER CustomerNumber,
    oav.agreement_num Agreement_Number,
    :action action,
    aso_quotes.minisite_id minisite_id,
    (select imt.msite_name from ibe_msites_tl imt where imt.msite_id = aso_quotes.minisite_id
    and imt.language = userenv('LANG')) msite_name,
    (select asl.meaning from oe_lookups asl, aso_shipments ash
    where asl.lookup_type = 'SHIPMENT_PRIORITY'
    and asl.lookup_code = ash.shipment_priority_code
    and ash.quote_header_id = aso_quotes.quote_header_id) shipment_priority_name
    ,(select OE_SYS_PARAMETERS.VALUE('INSTALLMENT_OPTIONS',aso_quotes.org_id) from dual) enable_pay_now
    from
    hz_CONTACT_POINTS I_PHONE ,
    HZ_RELATIONSHIPS I_HEADER_CONTACT_REL,
    HZ_PARTIES I_HEADER_CONTACT_PARTY,
    ASO_QUOTE_HEADERS ASO_QUOTES,
    HZ_RELATIONSHIPS I_INVOICE_REL,
    HZ_PARTIES I_INVOICE_REL_PARTY,
    HZ_PARTY_sites I_INVOICE_PARTY_SITES,
    HZ_LOCATIONS I_INVOICE_LOCATIONS,
    HZ_PARTIES I_CUST_PARTIES,
    HZ_CUST_ACCOUNTS I_ACCTS,
    HZ_CUST_ACCOUNTS I_ACCTS_INV,
    HZ_PARTIES I_ACCTS_INV_PARTY,
    JTF_RS_SALESREPS_MO_V SALES,
    JTF_RS_SALESREPS_MO_V SALES1,
    FND_TERRITORIES_VL I_TERRITORIES,
    oe_agreements_vl oav
    where
    ASO_QUOTES.PARTY_ID = I_HEADER_CONTACT_REL.PARTY_ID(+)
    AND I_HEADER_CONTACT_REL.SUBJECT_ID = I_HEADER_CONTACT_PARTY.PARTY_ID(+)
    AND I_HEADER_CONTACT_REL.SUBJECT_TYPE(+) = 'PERSON'
    AND I_HEADER_CONTACT_REL.SUBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
    and i_header_contact_rel.object_id(+) = aso_quotes.cust_party_id
    AND ASO_QUOTES .INVOICE_TO_PARTY_SITE_ID = I_INVOICE_PARTY_SITES.PARTY_SITE_ID (+)
    AND I_INVOICE_PARTY_SITES.LOCATION_ID = I_INVOICE_LOCATIONS.LOCATION_ID(+)
    AND I_INVOICE_LOCATIONS.country = I_TERRITORIES.territory_code(+)
    AND ASO_QUOTES.INVOICE_TO_PARTY_ID = I_INVOICE_REL.PARTY_ID(+)
    AND I_INVOICE_REL.SUBJECT_ID = I_INVOICE_REL_PARTY.PARTY_ID(+)
    AND I_INVOICE_REL.SUBJECT_TYPE(+) = 'PERSON'
    AND I_INVOICE_REL.SUBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
    AND i_invoice_rel.object_id (+) = aso_quotes.invoice_to_cust_party_id
    AND ASO_QUOTES.ORG_ID = SALES.ORG_ID(+)
    AND ASO_QUOTES.EMPLOYEE_PERSON_ID = SALES.PERSON_ID (+)
    AND ASO_QUOTES.ORG_ID = SALES1.ORG_ID (+)
    AND ASO_QUOTES.RESOURCE_ID = SALES1.RESOURCE_ID (+)
    AND ASO_QUOTES.CUST_ACCOUNT_ID =I_ACCTS.CUST_ACCOUNT_ID(+)
    AND ASO_QUOTES.CUST_PARTY_ID = I_CUST_PARTIES.PARTY_ID
    AND ASO_QUOTES.INVOICE_TO_CUST_ACCOUNT_ID = I_ACCTS_INV.CUST_ACCOUNT_ID(+)
    AND ASO_QUOTES.INVOICE_TO_CUST_PARTY_ID = I_ACCTS_INV_PARTY.PARTY_ID(+)
    AND aso_quotes.phone_id = i_phone.contact_point_Id(+)
    AND oav.agreement_id(+) = aso_quotes.contract_id
    AND aso_quotes.quote_header_id = 666584
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912)
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:886)
         at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:1009)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:211)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
         at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:619)
    ## Detail 0 ##
    java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: 1
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11915)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3919)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13827)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:804)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:669)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3723)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:743)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:892)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:806)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:800)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3643)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.apps.aso.print.server.PrintQuoteAMImpl.queryQuote(PrintQuoteAMImpl.java:447)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
         at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:619)
    java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: 1
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11915)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3919)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13827)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:804)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:669)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3723)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:743)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:892)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:806)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:800)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3643)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.apps.aso.print.server.PrintQuoteAMImpl.queryQuote(PrintQuoteAMImpl.java:447)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
         at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:619)

    "java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL"
    Try the suggestions in this? https://kr.forums.oracle.com/forums/thread.jspa?messageID=10253362
    Check the bindign styles and bind variables..

  • Issue While executing the Query for Pagination using ROWNUM with like

    Issue While executing the Query for Pagination using ROWNUM with like.
    Database is Oracle11G.
    Oracle Database Table contains 8-9 lakh records
    1) SQL equal (=)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920'
    Execution Time:- 0.00869245 seconds
    Returns 2 resultsets
    2) SQL like (one %)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920%'
    Execution Time:- 0.01094301 seconds
    Returns 2 resultsets
    3) SQL like (two%)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE like '%KMF22600920%'
    Execution Time:- 6.43989658 seconds
    Returns 2 resultsets
    In Pagination, we are using Modified version of SQL Query 3) with ROWNUM as mentioned below :-
    4) SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) WHERE RNUM > 0
    Execution Time:- Infinite
    ResultSets:- No as execution time is infinite
    a) Instead of like if we use = in the above query it is returning the 2 resultsets (execution time 0.02699282 seconds)
    b) Instead of two % in the above query, if use one example REFERENCE like 'KMF22600920%' it is returning the 2 resultsets (execution time 0.03313019 seconds)
    Issue:- When using two % in like in the above query i.e. REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) , it is going to infinite.
    Could you please let us know what is the issue with two % used in like and rownum
    5) Modified version of Option1 query (move out the RNUM condition AND RNUM <= 20)
    SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' ) WHERE RNUM > 0 AND RNUM <= 20
    Execution Time:- 7.41368914 seconds
    Returns 2 resultsets
    Is the above query is best optimized query which should be used for the Pagination or still can improve on this ?

    This would be easier to diagnose if there was an explain plan posted for the 'good' and 'bad' queries. Generally speaking using '%' on both sides precludes the use of any indexes.

  • Need to modify the query

    Hi All,
    I am a new DBA. Please help me in modifying the below query in test envirnoment. It is long query.
    SELECT NVL(MIN(P_LAY),0), NVL(MIN(TID),0), NVL(MIN(TTIME),0), NVL(MIN(TSOURCE),0) FROM ( SELECT P_LAY, TID, TTIME, TSOURCE FROM ( SELECT (CASE WHEN T1.INTERNAL_TYPE=3 THEN -1 ELSE T_REPORT.GET_LAY(T1.EVE_ID, T1.EVE_TIME,:B4 ) END ) P_LAY, T1.EVE_ID TID, T1.EVE_TIME TTIME, T1.ALA_SOURCE_ID TSOURCE FROM T_EVE_LOG T1, T_EVE_LOG T2 WHERE T1.ALA_ID = T2.ROOT_ALA_ID AND T2.EVE_TIME >= :B3 AND T2.EVE_TIME < :B2 AND T2.ALA_ID = :B1 AND T2.ACT_ID IN (2,5) ) ORDER BY P_LAY ) WHERE ROWNUM = 1
    Thanks in Advance

    886755 wrote:
    Hi All,
    I am a new DBA. Please help me in modifying the below query in test envirnoment. It is long query.
    SELECT NVL(MIN(P_LAY),0), NVL(MIN(TID),0), NVL(MIN(TTIME),0), NVL(MIN(TSOURCE),0) FROM ( SELECT P_LAY, TID, TTIME, TSOURCE FROM ( SELECT (CASE WHEN T1.INTERNAL_TYPE=3 THEN -1 ELSE T_REPORT.GET_LAY(T1.EVE_ID, T1.EVE_TIME,:B4 ) END ) P_LAY, T1.EVE_ID TID, T1.EVE_TIME TTIME, T1.ALA_SOURCE_ID TSOURCE FROM T_EVE_LOG T1, T_EVE_LOG T2 WHERE T1.ALA_ID = T2.ROOT_ALA_ID AND T2.EVE_TIME >= :B3 AND T2.EVE_TIME < :B2 AND T2.ALA_ID = :B1 AND T2.ACT_ID IN (2,5) ) ORDER BY P_LAY ) WHERE ROWNUM = 1
    Thanks in Advancemodify it how to do what?
    SELECT Nvl(MIN(p_lay), 0),
           Nvl(MIN(tid), 0),
           Nvl(MIN(ttime), 0),
           Nvl(MIN(tsource), 0)
    FROM   (SELECT p_lay,
                   tid,
                   ttime,
                   tsource
            FROM   (SELECT ( CASE
                               WHEN t1.internal_type = 3 THEN -1
                               ELSE t_report.Get_lay(t1.eve_id, t1.eve_time, :B4)
                             END )          p_lay,
                           t1.eve_id        tid,
                           t1.eve_time      ttime,
                           t1.ala_source_id tsource
                    FROM   t_eve_log t1,
                           t_eve_log t2
                    WHERE  t1.ala_id = t2.root_ala_id
                           AND t2.eve_time >= :B3
                           AND t2.eve_time < :B2
                           AND t2.ala_id = :B1
                           AND t2.act_id IN ( 2, 5 ))
            ORDER  BY p_lay)
    WHERE  ROWNUM = 1 

  • Hi there, pls help since I upgraded the software to ios7 i have no more facetime neither in my contacts nor in settings... so i cannot activate it. anyone knows why this happened and how to fix it?thankso

    Hi there, pls help since I upgraded the software to ios7 i have no more facetime neither in my contacts nor in settings... so i cannot activate it. anyone knows why this happened and how to fix it?thanks

    Tap and hold the Home button and the On/Off buttons for approximately 10-15 seconds, until the Apple logo reappears. When the logo appears, release both buttons.
    No content is affected by this procedure.

  • Help needed to optimize the query

    Help needed to optimize the query:
    The requirement is to select the record with max eff_date from HIST_TBL and that max eff_date should be > = '01-Jan-2007'.
    This is having high cost and taking around 15mins to execute.
    Can anyone help to fine-tune this??
       SELECT c.H_SEC,
                    c.S_PAID,
                    c.H_PAID,
                    table_c.EFF_DATE
       FROM    MTCH_TBL c
                    LEFT OUTER JOIN
                       (SELECT b.SEC_ALIAS,
                               b.EFF_DATE,
                               b.INSTANCE
                          FROM HIST_TBL b
                         WHERE b.EFF_DATE =
                                  (SELECT MAX (b2.EFF_DATE)
                                     FROM HIST_TBL b2
                                    WHERE b.SEC_ALIAS = b2.SEC_ALIAS
                                          AND b.INSTANCE =
                                                 b2.INSTANCE
                                          AND b2.EFF_DATE >= '01-Jan-2007')
                               OR b.EFF_DATE IS NULL) table_c
                    ON  table_c.SEC_ALIAS=c.H_SEC
                       AND table_c.INSTANCE = 100;

    To start with, I would avoid scanning HIST_TBL twice.
    Try this
    select c.h_sec
         , c.s_paid
         , c.h_paid
         , table_c.eff_date
      from mtch_tbl c
      left
      join (
              select sec_alias
                   , eff_date
                   , instance
                from (
                        select sec_alias
                             , eff_date
                             , instance
                             , max(eff_date) over(partition by sec_alias, instance) max_eff_date
                          from hist_tbl b
                         where eff_date >= to_date('01-jan-2007', 'dd-mon-yyyy')
                            or eff_date is null
               where eff_date = max_eff_date
                  or eff_date is null
           ) table_c
        on table_c.sec_alias = c.h_sec
       and table_c.instance  = 100;

  • What is the query for Accounts Payable Trial Balance (APXTRBAL) in 11.5.10?

    Hi Guys,
    What is the query for Accounts Payable Trial Balance (APXTRBAL) in 11.5.10?
    I have to write an AP Invoice Aging Report in Discoverer to show all unpaid invoices that have been transferred into GL... Business wants it to match one-to-one with the AP Trial Balance standard report...
    Business wants to run the report for any date in a past...
    The report has two parameters:
    As Of Date - the same as As of Date for the AP Trial Report
    Trial Balance Run Date - the date when Trial Balance was run...
    Conditions are:
    TRUNC(Invoice Date) <=TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
    TRUNC(NVL(Payment Date,'01-JAN-5000')) > TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
    TRUNC(Invoice Creation Date) <= TRUNC(NVL(TO_DATE(:Trial Balance Run Date),SYSDATE))
    Distr Accounting Date <= TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
    NVL(Distr Creation Date,Invoice Creation Date) <= TRUNC(NVL(TO_DATE(:Trial Balance Run Date),SYSDATE))
    Show_Flag = 'YES', where:
    Show_Flag = CASE WHEN ( NVL(Cancelled Date,'01-JAN-1901') > NVL(:As Of Date,SYSDATE) AND NVL(Inv Amount Aud,0) = 0 ) THEN 'YES' ELSE ( CASE WHEN NVL(Inv Amount Aud,0) = 0 THEN 'NO' ELSE 'YES' END ) END
    There is a difference between the logic of my report, and the logic of AP Trial Balance...
    Could you please advise what I'm missing?
    Thanks,
    Iana

    What is the query for Accounts Payable Trial Balance (APXTRBAL) in 11.5.10? You can get the code by opening the report in Reports Builder and get the query.
    Or, enable trace/debug as per (FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12 [ID 296559.1]).
    Thanks,
    Hussein

  • Report conversion tool--Can we modify the query

    Hi all,
    I have some freehand SQL reports converted into WebI reports. I understand that report conversion tool, creates a new universe for each of the freehand SQL report. But if I try to edit the query, like add a filter condition, an error pops out.
    Is it possible to edit the query if we convert freehand sql reports into webi reports?
    Regards
    Ash.

    Hi,
    Yes it is possible to edit the query for the converted free hand sql query.
    If you see any problem while editing the SQL of the converted report, do a refresh once and try.
    Adding query filter also works fine.
    Issue from your end could also be due to security settings.i advise to revisit the security once and make sure all appropriate rights are available for the user.
    Thanks,
    Sri

  • Help: how to modify a setting for a running

    solaris 10 10/05 on sUN E3000
    Q: how to modify the setting for a running zone.
    I want to add a lofs mount for /usr/local read/write.
    also I want to add access to cdrom
    so I use zonecfg to "add fs ", and stuff then commit.
    now what should I do to make effect in the zone.
    thanks.

    to rephase my question:
    once I have a zone installed, is there a way to
    modify the zone settings , such as adding a fs
    or devices, without destory the zone? thanks.

Maybe you are looking for

  • After upgrading to yosemite, cannot login as mobile user

    After upgrading to Yosemite, I can no longer log on to the Mavericks server as a mobile user. The password prompt is first on the server instead, because only after I do I remove all network connections or disable, I can log in. The connection to the

  • Vector Mask Feather

    When I use the feather options on a Vector mask, it works but when I save the file, close it and open it again the feather settings are reset back to zero. I am using Photoshop CS4 Extended on windows XP. I saw that a mac user was having the same pro

  • Function: alm_me_notification_change

    Hi experts, i need to change cost center and wbs element in trans. iw22. i try to use this function without succeed.(i call this function and than i do commit) The sy-subrc = 0 and the "return" value is empty. thanks in advanced, Michal. Edited by: m

  • PDF Print error win printing many pages

    Hi. I have a problem then I try to print an PDF file with many pages. I have Windows 2003 as the OS, and the Adobe PDF Reader X 10.1 as my PDF reader, the printer is an HP LaserJet M602n with 512MB Memory. The setup is that we have some thin clients

  • Zen Asset Manager consulting

    Hi everyone, Is there a company anyone can recommend (other than Novell) for ZAM consulting? We were dealing with ITAM Services, who were two guys who were formerly with Tally, but they seem to have gone under. I'm looking to get some help with a 7.5