Please help rewrite the query

Hi ,
Below query is taking more time (4mins) for 41 rows returning and there is no full table scan .Can some one help to rewrite the query.
SELECT
          esma.candidate AS candidate_additional_sample,
          ccr.raw_mark,
          ccr.split_session_year AS year,
          ccr.split_session_month AS month,
          ccr.paper_code,
          ccr.assessment_school AS school_code,
          get_cand_session_number(ccr.split_session_year,ccr.split_session_month,ccr.candidate) AS candidate_session_number,
          ccr.candidate AS candidate_code,
          c.firstname AS candidate_firstname,
          c.lastname AS candidate_lastname,
          ema.moderator_code,
          ema.examiner_code,
          csr.self_taught
         FROM
          ibis.candidate_component_reg ccr
        INNER JOIN ibis.candidate_examiner_allocation cea
           ON ccr.split_session_year= cea.year
          AND ccr.split_session_month=cea.month
          AND ccr.assessment_school=cea.assessment_school
          AND ccr.paper_code= cea.paper_code
          AND ccr.candidate     =        cea.candidate
        INNER JOIN ibis.examination_paper ep
          ON ccr.split_session_year= ep.year
          AND ccr.split_session_month=ep.month
          AND ccr.paper_code=ep.paper_code
        INNER JOIN ibis.examiner_moderator_allocation ema
          ON ema.year =cea.year
          AND ema.month =cea.month
          AND ema.no_lang_code=ep.no_lang_code
          AND ema.examiner_code=cea.examiner_code
          AND ema.year =ccr.split_session_year
          AND ema.month =ccr.split_session_month
        INNER JOIN ibis.candidate_subject_registration csr
          ON ccr.split_session_year=csr.year
          AND ccr.split_session_month=csr.month
          AND ccr.main_school=csr.main_school
          AND ccr.candidate=csr.candidate
          AND ccr.subject=csr.subject
          AND ccr.subject_option=csr.subject_option
          AND ccr.lvl=csr.lvl
          AND ccr.language=csr.language 
        INNER JOIN ibis.candidate c
          ON ccr.candidate=c.candidate
        LEFT OUTER JOIN  ibis.exam_sample_mark_additional esma
          ON ccr.split_session_year = esma.year
          AND ccr.split_session_month  = esma.month
          AND ep.no_lang_code = esma.nolang_code
          AND ccr.candidate = esma.candidate
        WHERE
              ccr.split_session_year=:v_year
          AND ccr.split_session_month=:v_month
          AND ccr.subject=:v_subject
          AND ccr.subject_option=nvl(:v_subject_option,ccr.subject_option)
          AND ccr.language=nvl(:v_language, ccr.language)
          AND ccr.component=:v_component
          AND ccr.lvl=:v_lvl
          AND ccr.raw_mark IS NOT NULL          
          AND cea.examiner_code  = :v_examiner_code
          AND ((ccr.sampled='Y'
                  AND csr.self_taught='N'
                  AND EXISTS (SELECT 1 FROM ibis.subject_component sc
                              WHERE sc.assessment_method_id = 11
                                AND sc.assessment_type='INTERNAL'
                                AND ccr.split_session_year=sc.year
                                AND ccr.split_session_month=sc.month
                                AND ccr.paper_code=sc.paper_code
                                AND ccr.subject=sc.subject
                                AND ccr.subject_option=sc.subject_option
                                AND ccr.lvl=sc.lvl
                                AND ccr.language=sc.language
                                AND ccr.component=sc.component)
                  AND NOT EXISTS (SELECT 1 FROM ibis.cw_portfolio_template cpt
                                  WHERE ccr.split_session_year = cpt.year
                                    AND ccr.split_session_month = cpt.month
                                    AND ccr.subject = cpt.subject
                                    AND ccr.subject_option = cpt.subject_option
                                    AND ccr.component = cpt.component
                                    AND cpt.combined = 'Y')
                  AND NOT EXISTS (SELECT 1 FROM ibis.school_sample_mark ssm
                                  WHERE ssm.year= ccr.split_session_year
                                    AND ssm.month  = ccr.split_session_month
                                    AND ssm.paper_code  = ccr.paper_code
                                    AND ssm.candidate =ccr.candidate
                                    AND ssm.examiner_sample = 'Y'))
              OR (ccr.sampled='N'
                  AND csr.self_taught='Y'
                  AND EXISTS (SELECT 1 FROM ibis.subject_component sc
                              WHERE sc.assessment_method_id = 11
                                AND ccr.split_session_year=sc.year
                                AND ccr.split_session_month=sc.month
                                AND ccr.paper_code=sc.paper_code
                                AND ccr.subject=sc.subject
                                AND ccr.subject_option=sc.subject_option
                                AND ccr.lvl=sc.lvl
                                AND ccr.language=sc.language
                                AND ccr.component=sc.component)
                  AND NOT EXISTS (SELECT 1 FROM ibis.cw_portfolio_template cpt
                                  WHERE ccr.split_session_year = cpt.year
                                    AND ccr.split_session_month = cpt.month
                                    AND ccr.subject = cpt.subject
                                    AND ccr.subject_option = cpt.subject_option
                                    AND ccr.component = cpt.component
                                    AND cpt.combined = 'Y'))
              OR (ccr.sampled='N'
                  AND EXISTS (SELECT 1 FROM ibis.subject_component sc
                              WHERE sc.assessment_method_id = 11
                                AND ccr.split_session_year=sc.year
                                AND ccr.split_session_month=sc.month
                                AND ccr.paper_code=sc.paper_code
                                AND ccr.subject=sc.subject
                                AND ccr.subject_option=sc.subject_option
                                AND ccr.lvl=sc.lvl
                                AND ccr.language=sc.language
                                AND ccr.component=sc.component)
                  AND EXISTS (SELECT 1 FROM ibis.cw_portfolio_template cpt
                                  WHERE ccr.split_session_year = cpt.year
                                    AND ccr.split_session_month = cpt.month
                                    AND ccr.subject = cpt.subject
                                    AND ccr.subject_option = cpt.subject_option
                                    AND ccr.component = cpt.component
                                    AND cpt.combined = 'Y')));
explain plan
line 1: SQLPLUS Command Skipped: set linesize 130
line 2: SQLPLUS Command Skipped: set pagesize 0
PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                                           
Plan hash value: 2594643366                                                                                                                                                                                                                                                                                 
| Id  | Operation                             | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |                                                                                                                                                                                    
|   0 | SELECT STATEMENT                      |                                |     2 |  1036 |    34   (3)| 00:00:01 |                                                                                                                                                                                    
|*  1 |  FILTER                               |                                |       |       |            |          |                                                                                                                                                                                    
|*  2 |   HASH JOIN OUTER                     |                                |     2 |  1036 |    34   (3)| 00:00:01 |                                                                                                                                                                                    
|   3 |    VIEW                               |                                |     2 |   974 |    32   (0)| 00:00:01 |                                                                                                                                                                                    
|   4 |     CONCATENATION                     |                                |       |       |            |          |                                                                                                                                                                                    
|*  5 |      FILTER                           |                                |       |       |            |          |                                                                                                                                                                                    
|*  6 |       TABLE ACCESS BY INDEX ROWID     | CANDIDATE_SUBJECT_REGISTRATION |     1 |    58 |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|   7 |        NESTED LOOPS                   |                                |     1 |   485 |    16   (0)| 00:00:01 |                                                                                                                                                                                    
|   8 |         NESTED LOOPS                  |                                |     1 |   427 |    13   (0)| 00:00:01 |                                                                                                                                                                                    
|   9 |          NESTED LOOPS                 |                                |     1 |   357 |    11   (0)| 00:00:01 |                                                                                                                                                                                    
|  10 |           NESTED LOOPS                |                                |     1 |   129 |     8   (0)| 00:00:01 |                                                                                                                                                                                    
|  11 |            NESTED LOOPS               |                                |     1 |    80 |     5   (0)| 00:00:01 |                                                                                                                                                                                    
|* 12 |             INDEX RANGE SCAN          | PK_EXAMINER_MODERATOR_ALLOC    |     1 |    39 |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 13 |             INDEX RANGE SCAN          | RFL_EP1                        |     1 |    41 |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|  14 |            TABLE ACCESS BY INDEX ROWID| CANDIDATE_EXAMINER_ALLOCATION  |     1 |    49 |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 15 |             INDEX RANGE SCAN          | CANDIDATE_ALLOCATION_EXAMINER  |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|* 16 |           TABLE ACCESS BY INDEX ROWID | CANDIDATE_COMPONENT_REG        |     1 |   228 |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 17 |            INDEX RANGE SCAN           | SPLIT_SESSION_CANDIDATE        |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|  18 |          TABLE ACCESS BY INDEX ROWID  | CANDIDATE                      |     1 |    70 |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|* 19 |           INDEX UNIQUE SCAN           | CANDIDATE_PK                   |     1 |       |     1   (0)| 00:00:01 |                                                                                                                                                                                    
|* 20 |         INDEX RANGE SCAN              | Y_M_CAND_SUBJ_LVL_OPTION       |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|* 21 |      FILTER                           |                                |       |       |            |          |                                                                                                                                                                                    
|* 22 |       TABLE ACCESS BY INDEX ROWID     | CANDIDATE_SUBJECT_REGISTRATION |     1 |    58 |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|  23 |        NESTED LOOPS                   |                                |     1 |   485 |    16   (0)| 00:00:01 |                                                                                                                                                                                    
|  24 |         NESTED LOOPS                  |                                |     1 |   427 |    13   (0)| 00:00:01 |                                                                                                                                                                                    
|  25 |          NESTED LOOPS                 |                                |     1 |   357 |    11   (0)| 00:00:01 |                                                                                                                                                                                    
|  26 |           NESTED LOOPS                |                                |     1 |   129 |     8   (0)| 00:00:01 |                                                                                                                                                                                    
|  27 |            NESTED LOOPS               |                                |     1 |    80 |     5   (0)| 00:00:01 |                                                                                                                                                                                    
|* 28 |             INDEX RANGE SCAN          | PK_EXAMINER_MODERATOR_ALLOC    |     1 |    39 |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 29 |             INDEX RANGE SCAN          | RFL_EP1                        |     1 |    41 |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|  30 |            TABLE ACCESS BY INDEX ROWID| CANDIDATE_EXAMINER_ALLOCATION  |     1 |    49 |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 31 |             INDEX RANGE SCAN          | CANDIDATE_ALLOCATION_EXAMINER  |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|* 32 |           TABLE ACCESS BY INDEX ROWID | CANDIDATE_COMPONENT_REG        |     1 |   228 |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 33 |            INDEX RANGE SCAN           | SPLIT_SESSION_CANDIDATE        |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|  34 |          TABLE ACCESS BY INDEX ROWID  | CANDIDATE                      |     1 |    70 |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|* 35 |           INDEX UNIQUE SCAN           | CANDIDATE_PK                   |     1 |       |     1   (0)| 00:00:01 |                                                                                                                                                                                    
|* 36 |         INDEX RANGE SCAN              | Y_M_CAND_SUBJ_LVL_OPTION       |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                                    
|* 37 |    INDEX RANGE SCAN                   | EXAM_SAMP_MARK_ADD_IOT_PK      |    36 |  1116 |     1   (0)| 00:00:01 |                                                                                                                                                                                    
|* 38 |   TABLE ACCESS BY INDEX ROWID         | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                                    
|* 39 |    INDEX RANGE SCAN                   | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 40 |    TABLE ACCESS BY INDEX ROWID        | SCHOOL_SAMPLE_MARK             |     1 |    34 |     4   (0)| 00:00:01 |                                                                                                                                                                                    
|* 41 |     INDEX RANGE SCAN                  | CAND_PAPER_YEAR_MONTH          |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 42 |     TABLE ACCESS BY INDEX ROWID       | SUBJECT_COMPONENT              |     1 |    96 |     4   (0)| 00:00:01 |                                                                                                                                                                                    
|* 43 |      INDEX RANGE SCAN                 | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 44 |      TABLE ACCESS BY INDEX ROWID      | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                                    
|* 45 |       INDEX RANGE SCAN                | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 46 |       TABLE ACCESS BY INDEX ROWID     | SUBJECT_COMPONENT              |     1 |    87 |     4   (0)| 00:00:01 |                                                                                                                                                                                    
|* 47 |        INDEX RANGE SCAN               | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 48 |        TABLE ACCESS BY INDEX ROWID    | SUBJECT_COMPONENT              |     1 |    87 |     4   (0)| 00:00:01 |                                                                                                                                                                                    
|* 49 |         INDEX RANGE SCAN              | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                                    
|* 50 |         TABLE ACCESS BY INDEX ROWID   | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                                    
|* 51 |          INDEX RANGE SCAN             | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                                    
  Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
   1 - filter("from$_subquery$_011"."SAMPLED"='Y' AND "from$_subquery$_011"."SELF_TAUGHT"='N' AND  NOT EXISTS                                                                                                                                                                                               
              (SELECT /*+ */ 0 FROM "IBIS"."CW_PORTFOLIO_TEMPLATE" "CPT" WHERE "CPT"."COMPONENT"=:B1 AND                                                                                                                                                                                                    
              "CPT"."SUBJECT_OPTION"=:B2 AND "CPT"."SUBJECT"=:B3 AND "CPT"."MONTH"=:B4 AND "CPT"."YEAR"=:B5 AND                                                                                                                                                                                             
              "CPT"."COMBINED"='Y') AND  NOT EXISTS (SELECT /*+ */ 0 FROM "IBIS"."SCHOOL_SAMPLE_MARK" "SSM" WHERE                                                                                                                                                                                           
              "SSM"."MONTH"=:B6 AND "SSM"."YEAR"=:B7 AND "SSM"."PAPER_CODE"=:B8 AND "SSM"."CANDIDATE"=:B9 AND                                                                                                                                                                                               
              "SSM"."EXAMINER_SAMPLE"='Y') AND  EXISTS (SELECT /*+ */ 0 FROM "IBIS"."SUBJECT_COMPONENT" "SC" WHERE                                                                                                                                                                                          
              "SC"."COMPONENT"=:B10 AND "SC"."SUBJECT_OPTION"=:B11 AND "SC"."LANGUAGE"=:B12 AND "SC"."LVL"=:B13 AND                                                                                                                                                                                         
              "SC"."SUBJECT"=:B14 AND "SC"."MONTH"=:B15 AND "SC"."YEAR"=:B16 AND "SC"."PAPER_CODE"=:B17 AND                                                                                                                                                                                                 
              "SC"."ASSESSMENT_METHOD_ID"=11 AND "SC"."ASSESSMENT_TYPE"='INTERNAL') OR "from$_subquery$_011"."SAMPLED"='N'                                                                                                                                                                                  
              AND "from$_subquery$_011"."SELF_TAUGHT"='Y' AND  NOT EXISTS (SELECT /*+ */ 0 FROM                                                                                                                                                                                                             
              "IBIS"."CW_PORTFOLIO_TEMPLATE" "CPT" WHERE "CPT"."COMPONENT"=:B18 AND "CPT"."SUBJECT_OPTION"=:B19 AND                                                                                                                                                                                         
              "CPT"."SUBJECT"=:B20 AND "CPT"."MONTH"=:B21 AND "CPT"."YEAR"=:B22 AND "CPT"."COMBINED"='Y') AND  EXISTS (SELECT                                                                                                                                                                               
              /*+ */ 0 FROM "IBIS"."SUBJECT_COMPONENT" "SC" WHERE "SC"."COMPONENT"=:B23 AND "SC"."SUBJECT_OPTION"=:B24 ANDEdited by

Can you please post the following scripts:
1. Tables structure (with all indexes & constraints)
2. Tables data
3. SQL trace file
possibly everything that one can need to regenerate the scenario on his own DB...
OR
spend some time with Oracle Docs on Performance Tuning and then resolve it yourself.
Regards,
Ankit Rathi
http://theoraclelog.blogspot.in

Similar Messages

  • Please Help for the Query

    Please Help for the Query
    Hi frds please help me for the below query.What I want to do is to pull out the data from below table :-
    date ticker indicator
    03/13/2008 3IINFOTECH -8
    03/18/2008 3IINFOTECH -4
    03/25/2008 3IINFOTECH -5
    03/27/2008 3IINFOTECH -3
    as such :-
    date ticker indicator
    03/13/2008 3IINFOTECH -8
    03/25/2008 3IINFOTECH -5
    03/27/2008 3IINFOTECH -3
    Here I want to find the Trend i.e either asc or desc order from the lowest indicator.
    In the above sample data -8, -4, -5, -3 out of which I want the asc order data -8, -5, -3 and exclude -4 data.Because the asc order -8, -5, -3 will not follow.
    So I want the data
    date ticker indicator
    03/13/2008 3IINFOTECH -8
    03/25/2008 3IINFOTECH -5
    03/27/2008 3IINFOTECH -3

    SQL> CREATE TABLE BORRAME(FECHA DATE, INDICA VARCHAR2(100));
    Tabla creada.
    SQL> INSERT INTO BORRAME VALUES(TO_DATE('03/13/2008','MM/DD/YYYY'), '3IINFOTECH -8');
    1 fila creada.
    SQL> INSERT INTO BORRAME VALUES(TO_DATE('03/18/2008','MM/DD/YYYY'), '3IINFOTECH -4');
    1 fila creada.
    SQL> INSERT INTO BORRAME VALUES(TO_DATE('03/25/2008','MM/DD/YYYY'), '3IINFOTECH -5');
    1 fila creada.
    SQL> INSERT INTO BORRAME VALUES(TO_DATE('03/27/2008','MM/DD/YYYY'), '3IINFOTECH -3');
    1 fila creada.
    SQL> COMMIT;
    Validación terminada.
    SQL>
    SQL> SELECT FECHA, INDICA
      2  FROM BORRAME
      3  WHERE SUBSTR(INDICA,INSTR(INDICA,'-',1)+1,LENGTH(INDICA)) <> '4'
      4  ORDER BY SUBSTR(INDICA,INSTR(INDICA,'-',1)+1,LENGTH(INDICA)) DESC;
    FECHA                                                                
    INDICA                                                               
    13/03/08                                                             
    3IINFOTECH -8                                                        
    25/03/08                                                             
    3IINFOTECH -5                                                        
    27/03/08                                                             
    3IINFOTECH -3                                                        
                    

  • Please help with the query (INSERT RETURNING BULK COLLECT INTO)

    I am trying to write a query inside the C# code where I would insert values into a table in bulk using bind variables. But I also I would like to receive a bulk collection of generated sequence number IDs for the REQUEST_ID. I am trying to use RETURNING REQUEST_ID BULK COLLECT INTO :REQUEST_IDs clause where :REQUEST_IDs is another bind variable
    Here is a full query that use in the C# code
    INSERT INTO REQUESTS_TBL(REQUEST_ID, CID, PROVIDER_ID, PROVIDER_NAME, REQUEST_TYPE_ID, REQUEST_METHOD_ID, SERVICE_START_DT, SERVICE_END_DT, SERVICE_LOCATION_CITY, SERVICE_LOCATION_STATE, BENEFICIARY_FIRST_NAME,
    BENEFICIARY_LAST_NAME, BENEFICIARY_DOB, HICNUM, CCN, CLAIM_RECEIPT_DT, ADMISSION_DT, BILL_TYPE,
    LANGUAGE_ID, CONTRACTOR_ID, PRIORITY_ID, UNIVERSE_DT, REQUEST_DT, BENEFICIARY_M_INITIAL,
    ATTENDING_PROVIDER_NUMBER, BILLING_NPI, BENE_ZIP_CODE, DRG, FINAL_ALLOWED_AMT, STUDY_ID, REFERRING_NPI)
    VALUES
    (SQ_CDCDATA.NEXTVAL, :CIDs, :PROVIDER_IDs, :PROVIDER_NAMEs, :REQUEST_TYPE_IDs,
    :REQUEST_METHOD_IDs, :SERVICE_START_DTs, :SERVICE_END_DTs, :SERVICE_LOCATION_CITYs,
    :SERVICE_LOCATION_STATEs, :BENEFICIARY_FIRST_NAMEs, :BENEFICIARY_LAST_NAMEs, :BENEFICIARY_DOBs,
    :HICNUMs, :CCNs, :CLAIM_RECEIPT_DTs, :ADMISSION_DTs, :BILL_TYPEs, :LANGUAGE_IDs,
    :CONTRACTOR_IDs, :PRIORITY_IDs, :UNIVERSE_DTs, :REQUEST_DTs, :BENEFICIARY_M_INITIALs,
    :ATTENDING_PROVIDER_NUMBERs, :BILLING_NPIs, :BENE_ZIP_CODEs, :DRGs, :FINAL_ALLOWED_AMTs,
    :STUDY_IDs, :REFERRING_NPIs) RETURNING REQUEST_ID BULK COLLECT INTO :REQUEST_IDs
    However, when I run this query, it gives me a strange error ORA-00925: missing INTO keyword. I am not sure what that error means since I am not missing any INTOs
    Please help me resolve this error or I would appreciate a different solution
    Thank you

    You cannot use (and do not want to in this case) the BULK COLLECT.
    create table for_testing
       the_id      number not null primary key,
       some_data   number
    declare
       l_return_value for_testing.the_id%type;
    begin
      4 
       insert into for_testing
          the_id,
          some_data
       values
          1,
          5
       returning the_id into l_return_value;
       dbms_output.put_line('the return values is ' || l_return_value);
    end;
    20  /
    the return values is 1
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.02
    TUBBY_TUBBZ?Is a simple example. In the future, please use the tags to preserve formatting on your code like i have so it remains readable .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Please help with the query creating Materialized View

    Hi,
    We are using the below query to create a Materialized View but it has been running since 3 hours. It is an Oracle 9i database running in HP-UX.The quey is as follows,
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                    AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    AND B.COMPL_GRP_TXT'Reoperations'
                    AND D.COMPL_TYPE_TXT'Intra-operative Misadventure'
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    union
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                   AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    --AND B.COMPL_GRP_TXT'Reoperations'
                    AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
                    AND B.PROC_DAY=C.PROC_DAY
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    union
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                    AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    AND B.COMPL_GRP_TXT='Reoperations'
                    --AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
                    AND B.PROC_DAY>C.PROC_DAY
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    The explain plan is as follows,
    PLAN_TABLE_OUTPUT
    | Id  | Operation                          |  Name                    | Rows  | Bytes |TempSpc| Cost  |  TQ    |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT                   |                          | 46935 |  6716K|       | 10648 |        |      |            |
    |   1 |  SORT UNIQUE                       |                          | 46935 |  6716K|    14M| 10648 | 45,14  | P->S | QC (RAND)  |
    |   2 |   UNION-ALL                        |                          |       |       |       |       | 45,13  | P->P | HASH       |
    |*  3 |    HASH JOIN                       |                          | 42801 |  6102K|       |  4640 | 45,13  | PCWP |            |
    |*  4 |     TABLE ACCESS FULL              | EES_CLINCL_COMPL_ICD     |   875 | 18375 |       |     2 | 45,02
    |*  5 |     HASH JOIN                      |                          | 41552 |  5072K|    14M|  4638 | 45,13  | PCWP |            |
    |*  6 |      TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1430K|    40M|       |  2855 | 45,03
    |*  7 |      HASH JOIN                     |                          |   628K|    56M|       |   494 | 45,10  | P->P | HASH       |
    |*  8 |       TABLE ACCESS FULL            | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,08 
    |*  9 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINICAL_COMPL_DATA  |  2090K|    71M|       |   49
    |  10 |        BITMAP CONVERSION TO ROWIDS |                          |       |       |       |       |        |    
    |* 11 |         BITMAP INDEX FULL SCAN     | INX_COMPL_GRP            |       |       |       |       |        |
    |* 12 |    TABLE ACCESS BY INDEX ROWID     | EES_CLINICAL_DATA        |     1 |    33 |       |     1
    |  13 |     NESTED LOOPS                   |                          |  1327 |   196K|       |   947 | 45,13  | PCWP |            |
    |* 14 |      HASH JOIN                     |                          | 60205 |  6996K|       |   495 | 45,13  | PCWP |            |
    |  15 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINCL_COMPL_ICD     |    36 |   756 |       |    
    |* 16 |        INDEX RANGE SCAN            | COMPL_TYPE_TXT_3         |     1 |       |       |     1 |     
    |* 17 |       HASH JOIN                    |                          |  1420K|   132M|       |   494 | 45,13  | PCWP |            |
    |* 18 |        TABLE ACCESS FULL           | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,11 
    |* 19 |        TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA  |  4722K|   175M|       |   49
    |  20 |         BITMAP CONVERSION TO ROWIDS|                          |       |       |       |       |        |      |           
    |  21 |          BITMAP INDEX FULL SCAN    | INX_COMPL_GRP            |       |       |       |       |        |
    |* 22 |      INDEX RANGE SCAN              | EES_CLINICAL_DATA_IND1   |     1 |       |       |     2 | 45,13
    |* 23 |    HASH JOIN                       |                          |  2807 |   416K|       |  4695 | 45,13  | PCWP |            |
    |  24 |     TABLE ACCESS FULL              | EES_CLINCL_COMPL_ICD     |   911 | 19131 |       |     2 | 45,06
    |* 25 |     HASH JOIN                      |                          |  2617 |   334K|    15M|  4693 | 45,13  | PCWP |            |
    |* 26 |      TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1430K|    45M|       |  2855 | 45,07
    |* 27 |      HASH JOIN                     |                          |   791K|    74M|       |   305 | 45,12  | P->P | HASH       |
    |* 28 |       TABLE ACCESS FULL            | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,09 
    |* 29 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINICAL_COMPL_DATA  |  2632K|    97M|       |   30
    |  30 |        BITMAP CONVERSION TO ROWIDS |                          |       |       |       |       |        |    
    |* 31 |         BITMAP INDEX SINGLE VALUE  | INX_COMPL_GRP            |       |       |       |       |        |
    Predicate Information (identified by operation id):
       3 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
       4 - filter("D"."COMPL_TYPE_TXT"'Intra-operative Misadventure')
       5 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
       6 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
       7 - access("A"."ICD_CODE"="B"."ICD_CODE")
       8 - filter("A"."SPECIALTY"='Colo-Rectal')
       9 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      11 - filter("B"."COMPL_GRP_TXT"'Reoperations')
      12 - filter("B"."ICD_CODE"="C"."ICD_CODE" AND "C"."PROC_TYPE"'L' AND "B"."PROC_DAY"="C"."PROC_DA
      14 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
      16 - access("D"."COMPL_TYPE_TXT"='Intra-operative Misadventure')
      17 - access("A"."ICD_CODE"="B"."ICD_CODE")
      18 - filter("A"."SPECIALTY"='Colo-Rectal')
      19 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      22 - access("B"."PAT_KEY"="C"."PAT_KEY")
      23 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
      25 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
           filter("B"."PROC_DAY">"C"."PROC_DAY")
      26 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
      27 - access("A"."ICD_CODE"="B"."ICD_CODE")
      28 - filter("A"."SPECIALTY"='Colo-Rectal')
      29 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      31 - access("B"."COMPL_GRP_TXT"='Reoperations')
    Note: cpu costing is offPlease help.

    Try removing the hints.
    Is 47,000 a reasonable estimate of how many rows you expect in the results?
    See these posts for other information that you should supply.
    HOW TO: Post a SQL statement tuning request
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long
    When your query takes too long ...

  • Please help create the query

    I have table which has 4 columns (A,B,C,D)
    Table t1
    A B C D
    1 - - -
    - 2 - -
    - - 3 -
    - - - 4
    5 - - -
    - 6 - -
    - - 7 -
    - - - 8
    the required output is
    Table T2
    A B C D
    1 2 3 4
    5 6 7 8
    How can i come up with this output

    like this
    with t
    as
    select 1 c1, null c2, null c3, null c4 from dual union all
    select null, 2, null, null from dual union all
    select null, null, 3, null from dual union all
    select null, null, null, 4 from dual union all
    select 5, null, null, null from dual union all
    select null, 6, null, null from dual union all
    select null, null, 7, null from dual union all
    select null, null, null, 8 from dual
    select max(c1), max(c2), max(c3), max(c4)
      from (
             select t.*,
                    last_value(c1 ignore nulls) over(order by nvl(c1,0)+nvl(c2,0)+nvl(c3,0)+nvl(c4,0)) gval
               from t
    group by gval

  • Help in rewrite the Query

    Hello
    I have one query taking time to fetch the records. Table contains just 40,000 thousands records but lots of case statement in the query, I just remove lots of case statement there are lot more...
    Can you please help me out to rewrite the query to fetch the records faster. Also Right now there are no indexes on the table....
    SELECT O.cn,
           O.BEN_LAST_NAME,
           O.BEN_FIRST_NAME,
           O.BEN_MI,
           O.SSN,
           O.DOB,
           O.SEX,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 00 AND 34 THEN
               1
              ELSE
               0
           END AS AGE_GROUP0_34_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 35 AND 44 THEN
               1
              ELSE
               0
           END AS AGE_GROUP35_44_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 45 AND 54 THEN
               1
              ELSE
               0
           END AS AGE_GROUP45_54_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 55 AND 59 THEN
               1
              ELSE
               0
           END AS AGE_GROUP55_59_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 60 AND 64 THEN
               1
              ELSE
               0
           END AS AGE_GROUP60_64_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 65 AND 69 THEN
               1
              ELSE
               0
           END AS AGE_GROUP65_69_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 70 AND 74 THEN
               1
              ELSE
               0
           END AS AGE_GROUP70_74_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 75 AND 79 THEN
               1
              ELSE
               0
           END AS AGE_GROUP75_79_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 80 AND 84 THEN
               1
              ELSE
               0
           END AS AGE_GROUP80_84_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 85 AND 89 THEN
               1
              ELSE
               0
           END AS AGE_GROUP85_89_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 90 AND 94 THEN
               1
              ELSE
               0
           END AS AGE_GROUP90_94_F,
           CASE
              WHEN O.SEX = 'F' AND O.AGE BETWEEN 95 AND 00 THEN
               1
              ELSE
               0
           END AS AGE_GROUP95_GT_F,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 00 AND 34 THEN
               1
              ELSE
               0
           END AS AGE_GROUP0_34_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 35 AND 44 THEN
               1
              ELSE
               0
           END AS AGE_GROUP35_44_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 45 AND 54 THEN
               1
              ELSE
               0
           END AS AGE_GROUP45_54_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 45 AND 59 THEN
               1
              ELSE
               0
           END AS AGE_GROUP55_59_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 60 AND 64 THEN
               1
              ELSE
               0
           END AS AGE_GROUP60_64_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 65 AND 69 THEN
               1
              ELSE
               0
           END AS AGE_GROUP65_69_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 70 AND 74 THEN
               1
              ELSE
               0
           END AS AGE_GROUP70_74_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 75 AND 79 THEN
               1
              ELSE
               0
           END AS AGE_GROUP75_79_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 80 AND 84 THEN
               1
              ELSE
               0
           END AS AGE_GROUP80_84_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 85 AND 89 THEN
               1
              ELSE
               0
           END AS AGE_GROUP85_89_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 90 AND 94 THEN
               1
              ELSE
               0
           END AS AGE_GROUP90_94_M,
           CASE
              WHEN O.SEX = 'M' AND O.AGE BETWEEN 95 AND 00 THEN
               1
              ELSE
               0
           END AS AGE_GROUP95_GT_M,
           O.YEAR,
          CASE WHEN EXISTS (SELECT m1.hcc_model_category1 FROM HCC_MODEL_DIAGNOSIS M1 , HCC_MODEL_DIAGNOSIS_MAPPING HM
                            ,mor222 m2 WHERE m1.map_id = hm.map_id_ref
                            AND m2.YEAR = hm.YEAR
                            AND o.cn = m2.cn
                            AND o.YEAR = hm.YEAR
                            AND m1.hcc_model_category1 = 1
                            AND m2.diag_code = m1.icd9cmscode) THEN 1 ELSE 0 END AS DISEASE_COEF_HCC1,
          CASE WHEN EXISTS (SELECT m1.hcc_model_category1 FROM HCC_MODEL_DIAGNOSIS M1 , HCC_MODEL_DIAGNOSIS_MAPPING HM
                            ,mor222 m2 WHERE m1.map_id = hm.map_id_ref
                            AND m2.YEAR = hm.YEAR
                            AND o.cn = m2.cn
                            AND o.YEAR = hm.YEAR
                            AND m1.hcc_model_category1 = 2
                            AND m2.diag_code = m1.icd9cmscode) THEN 1 ELSE 0 END AS DISEASE_COEF_HCC2,
           CASE WHEN EXISTS (SELECT m1.hcc_model_category1 FROM HCC_MODEL_DIAGNOSIS M1 , HCC_MODEL_DIAGNOSIS_MAPPING HM
                            ,mor222 m2 WHERE m1.map_id = hm.map_id_ref
                            AND m2.YEAR = hm.YEAR
                            AND o.cn = m2.cn
                            AND o.YEAR = hm.YEAR
                            AND m1.hcc_model_category1 = 5
                             AND m2.diag_code = m1.icd9cmscode) THEN 1 ELSE 0 END AS       DISEASE_COEF_HCC5,
            CASE WHEN EXISTS (SELECT m1.hcc_model_category1 FROM HCC_MODEL_DIAGNOSIS M1 , HCC_MODEL_DIAGNOSIS_MAPPING HM
                            ,mor222 m2 WHERE m1.map_id = hm.map_id_ref
                            AND m2.YEAR = hm.YEAR
                            AND o.cn = m2.cn
                            AND o.YEAR = hm.YEAR
                            AND m1.hcc_model_category1 = 7
                            AND m2.diag_code = m1.icd9cmscode) THEN 1 ELSE 0 END AS      DISEASE_COEF_HCC7,
           CASE WHEN EXISTS (SELECT m1.hcc_model_category1 FROM HCC_MODEL_DIAGNOSIS M1 , HCC_MODEL_DIAGNOSIS_MAPPING HM
                            ,mor222 m2 WHERE m1.map_id = hm.map_id_ref
                            AND m2.YEAR = hm.YEAR
                            AND o.cn = m2.cn
                            AND o.YEAR = hm.YEAR
                            AND m1.hcc_model_category1 = 8
                            AND m2.diag_code = m1.icd9cmscode) THEN 1 ELSE 0 END AS       DISEASE_COEF_HCC8                   
      FROM (SELECT T.cn,
                   T.BEN_LAST_NAME,
                   T.BEN_FIRST_NAME,
                   T.BEN_MI,
                   T.SSN,
                   TO_DATE(T.DOB, 'YYYYMMDD') AS DOB,
                   T.SEX,
                   TRUNC(MONTHS_BETWEEN(TO_DATE('01/01/' || T.YEAR, 'MM/DD/YYYY'),
                                        TO_DATE(T.DOB, 'YYYYMMDD')) / 12) AS AGE,
                   T.YEAR
              FROM mor111 T ) O Thanks in advance!
    Kind regards,
    Nik

    Ok, so I am going to be a little bit kinder then your first reply, but not much.
    From what can tell you are doing medical management and are trying to select by AGE/GENDER CELLS and this is common when trying to deal with RBRVS.
    This is by far some of the worst sql I have ever seen, sorry but it just is.
    So please report this either as a new post or as a reply and:
    1. At least post the table definitions and if you can some sample data.
    2. Get rid of almost all the case selectors.
    3. Describe the output you need.
    As it is this is unreadable.
    After that we can talk more.
    Edited by: FlyingGuy on Oct 11, 2011 5:13 PM

  • Help to rewrite the query --performance issue

    Hi ,
    Please help to rewrite the query since it's performance is not good.Especially second inline query(CASE statements are therein select caluse ..)is taking more cost.
    Database Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
    SELECT *
    FROM
      (SELECT q.*,
        COUNT(*) OVER() AS record_count,
        ROWNUM          AS row_num
      FROM
        (SELECT ExName.examiner_code,
          examiner_name,
          :v_year,
          :v_month,
          count_fb,
          NVL(count_entered_fb, 0) count_entered_fb,
          NVL(count_sent_fb, 0) count_sent_fb,
          NVL(count_edited_fb, 0) count_edited_fb,
          NVL(count_complete_fb, 0) count_complete_fb,
          NVL(count_withibcardiff_fb, 0) count_withibcardiff_fb
        FROM
          (SELECT examiner_code,
            COUNT(*) AS count_fb
          FROM
            (SELECT
                        examiner_code,
              paper_code,
              assessment_school
            FROM
              ( SELECT DISTINCT ce.examiner_code,
                ce.paper_code,
                ce.assessment_school
              FROM
                (SELECT
                  DISTINCT assessment_school,
                  paper_code,
                  examiner_code
                FROM candidate_examiner_allocation cea
                WHERE cea.element = 'Moderation of IA'
                AND cea.year      = :v_year
                AND cea.month     = :v_month
                ) ce,
                subject_group sg,
                subject_component sc
              WHERE (:v_padded_examiner_code IS NULL
              OR ce.examiner_code            = :v_padded_examiner_code)
              AND (:v_subject_group          IS NULL
              OR sg.group_number             = :v_subject_group)
              AND sg.year                    = :v_year
              AND sg.month                   = :v_month
              AND sc.year                    = :v_year
              AND sc.month                   = :v_month
              AND sc.paper_code              = ce.paper_code
              AND sc.subject                 = sg.subject
              AND sc.lvl                     = sg.lvl
              AND (:v_subject                IS NULL
              OR sc.subject                  = :v_subject)
              AND (:v_lvl                    IS NULL
              OR sc.lvl                      = :v_lvl)
              ) ea
          GROUP BY examiner_code
          ) ExName,
          (SELECT examiner_code,
            COUNT(
            CASE
              WHEN UPPER(wfi.status) = 'ENTERED'
              THEN 1
              ELSE NULL
            END) AS count_entered_fb,
            COUNT(
            CASE
              WHEN UPPER(wfi.status) = 'SENT'
              THEN 1
              ELSE NULL
            END) AS count_sent_fb,
            COUNT(
            CASE
              WHEN UPPER(wfi.status) = 'EDITED'
              THEN 1
              ELSE NULL
            END) AS count_edited_fb,
            COUNT(
            CASE
              WHEN UPPER(wfi.status) = 'COMPLETE'
              THEN 1
              ELSE NULL
            END) AS count_complete_fb,
            COUNT(
            CASE
              WHEN UPPER(wfi.status) = 'WITH IBCARDIFF'
              THEN 1
              ELSE NULL
            END) AS count_withibcardiff_fb
          FROM ia_instances ia1,
            workflow_instance wfi
          WHERE wfi.instance_id = ia1.workflow_instance_id
          AND ia1.year          = :v_year
          AND ia1.month         = :v_month
          GROUP BY ia1.year,
            ia1.month,
            examiner_code
          ) iaF,
          (SELECT person_code,
            title
            || ' '
            || firstname
            || ' '
            || lastname AS examiner_name
          FROM person
          WHERE :v_examiner_name IS NULL
          OR UPPER(title
            || ' '
            || firstname
            || ' '
            || lastname) LIKE :v_search_examiner_name
          ) P
        WHERE ExName.examiner_code = iaF.examiner_code (+)
        AND ExName.examiner_code   = p.person_code
        ORDER BY ExName.examiner_code
        ) q
      ) rc
    WHERE row_num >= :v_start_row
    AND row_num   <= (:v_start_row+(:v_max_row-1));explain plan
    line 1: SQLPLUS Command Skipped: set linesize 130
    line 2: SQLPLUS Command Skipped: set pagesize 0
    PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                                           
    Plan hash value: 1581970599                                                                                                                                                                                                                                                                                 
    | Id  | Operation                                 | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                        
    |   0 | SELECT STATEMENT                          |                                |     1 |   276 |       |  2187   (6)| 00:00:34 |                                                                                                                                                                        
    |*  1 |  FILTER                                   |                                |       |       |       |            |          |                                                                                                                                                                        
    |*  2 |   VIEW                                    |                                |     1 |   276 |       |  2187   (6)| 00:00:34 |                                                                                                                                                                        
    |   3 |    WINDOW BUFFER                          |                                |     1 |   250 |       |  2187   (6)| 00:00:34 |                                                                                                                                                                        
    |   4 |     COUNT                                 |                                |       |       |       |            |          |                                                                                                                                                                        
    |   5 |      VIEW                                 |                                |     1 |   250 |       |  2187   (6)| 00:00:34 |                                                                                                                                                                        
    |   6 |       SORT ORDER BY                       |                                |     1 |   119 |       |  2187   (6)| 00:00:34 |                                                                                                                                                                        
    |   7 |        NESTED LOOPS                       |                                |     1 |   119 |       |  2186   (6)| 00:00:34 |                                                                                                                                                                        
    |*  8 |         HASH JOIN OUTER                   |                                |     1 |    92 |       |  2185   (6)| 00:00:34 |                                                                                                                                                                        
    |   9 |          VIEW                             |                                |     1 |    20 |       |    51   (4)| 00:00:01 |                                                                                                                                                                        
    |  10 |           SORT GROUP BY                   |                                |     1 |     7 |       |    51   (4)| 00:00:01 |                                                                                                                                                                        
    |  11 |            VIEW                           |                                |     1 |     7 |       |    51   (4)| 00:00:01 |                                                                                                                                                                        
    |  12 |             SORT UNIQUE                   |                                |     1 |   127 |       |    51   (4)| 00:00:01 |                                                                                                                                                                        
    |  13 |              NESTED LOOPS                 |                                |     1 |   127 |       |    50   (2)| 00:00:01 |                                                                                                                                                                        
    |* 14 |               HASH JOIN                   |                                |     1 |    68 |       |    44   (3)| 00:00:01 |                                                                                                                                                                        
    |* 15 |                TABLE ACCESS BY INDEX ROWID| SUBJECT_COMPONENT              |    13 |   520 |       |    40   (0)| 00:00:01 |                                                                                                                                                                        
    |* 16 |                 INDEX RANGE SCAN          | SUBJECT_COMPONENT_ASSESS_TYPE  |  1059 |       |       |     9   (0)| 00:00:01 |                                                                                                                                                                        
    |* 17 |                INDEX RANGE SCAN           | SUBJECT_GROUP_PK               |    41 |  1148 |       |     3   (0)| 00:00:01 |                                                                                                                                                                        
    |* 18 |               INDEX RANGE SCAN            | CEA_AUTOMATIC_ALLOCATION_STATS |     5 |   295 |       |     6   (0)| 00:00:01 |                                                                                                                                                                        
    |  19 |          VIEW                             |                                |   679 | 48888 |       |  2133   (6)| 00:00:33 |                                                                                                                                                                        
    |  20 |           SORT GROUP BY                   |                                |   679 | 25123 |       |  2133   (6)| 00:00:33 |                                                                                                                                                                        
    |* 21 |            HASH JOIN                      |                                | 52408 |  1893K|  1744K|  2126   (6)| 00:00:33 |                                                                                                                                                                        
    |  22 |             TABLE ACCESS BY INDEX ROWID   | IA_INSTANCES                   | 52408 |  1125K|       |   688   (1)| 00:00:11 |                                                                                                                                                                        
    |* 23 |              INDEX RANGE SCAN             | IND_IA_INSTANCES               | 49077 |       |       |   137   (2)| 00:00:03 |                                                                                                                                                                        
    |  24 |             TABLE ACCESS FULL             | WORKFLOW_INSTANCE              |  1075K|    15M|       |   960   (7)| 00:00:15 |                                                                                                                                                                        
    |* 25 |         TABLE ACCESS BY INDEX ROWID       | PERSON                         |     1 |    27 |       |     1   (0)| 00:00:01 |                                                                                                                                                                        
    |* 26 |          INDEX UNIQUE SCAN                | PERSON_PK                      |     1 |       |       |     0   (0)| 00:00:01 |                                                                                                                                                                        
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
       1 - filter(TO_NUMBER(:V_START_ROW)<=TO_NUMBER(:V_START_ROW)+(TO_NUMBER(:V_MAX_ROW)-1))                                                                                                                                                                                                                   
       2 - filter("ROW_NUM">=TO_NUMBER(:V_START_ROW) AND "ROW_NUM"<=TO_NUMBER(:V_START_ROW)+(TO_NUMBER(:V_MAX_ROW)-1))                                                                                                                                                                                          
       8 - access("EXNAME"."EXAMINER_CODE"="IAF"."EXAMINER_CODE"(+))                                                                                                                                                                                                                                            
      14 - access("SC"."SUBJECT"="SG"."SUBJECT" AND "SC"."LVL"="SG"."LVL")                                                                                                                                                                                                                                      
      15 - filter((:V_SUBJECT IS NULL OR "SC"."SUBJECT"=:V_SUBJECT) AND ("SC"."LVL"=:V_LVL OR :V_LVL IS NULL))                                                                                                                                                                                                  
      16 - access("SC"."YEAR"=TO_NUMBER(:V_YEAR) AND "SC"."MONTH"=:V_MONTH)                                                                                                                                                                                                                                     
      17 - access("SG"."YEAR"=TO_NUMBER(:V_YEAR) AND "SG"."MONTH"=:V_MONTH)                                                                                                                                                                                                                                     
           filter(:V_SUBJECT_GROUP IS NULL OR "SG"."GROUP_NUMBER"=TO_NUMBER(:V_SUBJECT_GROUP))                                                                                                                                                                                                                  
      18 - access("CEA"."YEAR"=TO_NUMBER(:V_YEAR) AND "CEA"."MONTH"=:V_MONTH AND "SC"."PAPER_CODE"="PAPER_CODE" AND                                                                                                                                                                                             
                  "CEA"."ELEMENT"='Moderation of IA')                                                                                                                                                                                                                                                           
           filter("CEA"."ELEMENT"='Moderation of IA' AND (:V_PADDED_EXAMINER_CODE IS NULL OR                                                                                                                                                                                                                    
                  "EXAMINER_CODE"=:V_PADDED_EXAMINER_CODE))                                                                                                                                                                                                                                                     
      21 - access("WFI"."INSTANCE_ID"="IA1"."WORKFLOW_INSTANCE_ID")                                                                                                                                                                                                                                             
      23 - access("IA1"."YEAR"=TO_NUMBER(:V_YEAR) AND "IA1"."MONTH"=:V_MONTH)                                                                                                                                                                                                                                   
      25 - filter(:V_EXAMINER_NAME IS NULL OR UPPER("TITLE"||' '||"FIRSTNAME"||' '||"LASTNAME") LIKE :V_SEARCH_EXAMINER_NAME)                                                                                                                                                                                   
      26 - access("EXNAME"."EXAMINER_CODE"="PERSON_CODE")                                                                                                                                                                                                                                                       
    53 rows selected

    Hi,
    please find the below rigjt explan paln.
    PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                                           
    SQL_ID  2ct41vyyzqyh7, child number 0                                                                                                                                                                                                                                                                       
    SELECT *  FROM    (SELECT q.*,      COUNT(*) OVER() AS record_count,      ROWNUM          AS row_num    FROM      (SELECT                                                                                                                                                                                   
    ExName.examiner_code,        examiner_name,        :v_year,        :v_month,        count_fb,        NVL(count_entered_fb,                                                                                                                                                                                  
    0) count_entered_fb,        NVL(count_sent_fb, 0) count_sent_fb,        NVL(count_edited_fb, 0) count_edited_fb,                                                                                                                                                                                            
    NVL(count_complete_fb, 0) count_complete_fb,        NVL(count_withibcardiff_fb, 0) count_withibcardiff_fb      FROM                                                                                                                                                                                         
    (SELECT examiner_code,          COUNT(*) AS count_fb        FROM          (SELECT                                                                                                                                                                                                 
           examiner_code,            paper_code,            assessment_school          FROM            ( SELECT DISTINCT                                                                                                                                                                                        
    ce.examiner_code,              ce.paper_code,              ce.assessment_school            FROM              (SELECT                                                                                                                                                                                        
                            DISTINCT assessment_school,                                                                                                                                                                                                          
    paper_code,                examiner                                                                                                                                                                                                                                                                         
    Plan hash value: 651311258                                                                                                                                                                                                                                                                                  
    | Id  | Operation                                | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                         
    |   0 | SELECT STATEMENT                         |                                |       |       |       |  2785 (100)|          |                                                                                                                                                                         
    |*  1 |  FILTER                                  |                                |       |       |       |            |          |                                                                                                                                                                         
    |*  2 |   VIEW                                   |                                |     4 |  1104 |       |  2785   (7)| 00:00:43 |                                                                                                                                                                         
    |   3 |    WINDOW BUFFER                         |                                |     4 |  1000 |       |  2785   (7)| 00:00:43 |                                                                                                                                                                         
    |   4 |     COUNT                                |                                |       |       |       |            |          |                                                                                                                                                                         
    |   5 |      VIEW                                |                                |     4 |  1000 |       |  2785   (7)| 00:00:43 |                                                                                                                                                                         
    |   6 |       NESTED LOOPS                       |                                |     4 |   476 |       |  2785   (7)| 00:00:43 |                                                                                                                                                                         
    |   7 |        MERGE JOIN OUTER                  |                                |     4 |   368 |       |  2781   (7)| 00:00:43 |                                                                                                                                                                         
    |   8 |         VIEW                             |                                |     4 |    80 |       |    72   (3)| 00:00:02 |                                                                                                                                                                         
    |   9 |          SORT GROUP BY                   |                                |     4 |    28 |       |    72   (3)| 00:00:02 |                                                                                                                                                                         
    |  10 |           VIEW                           |                                |     4 |    28 |       |    72   (3)| 00:00:02 |                                                                                                                                                                         
    |  11 |            SORT UNIQUE                   |                                |     4 |   508 |       |    72   (3)| 00:00:02 |                                                                                                                                                                         
    |  12 |             NESTED LOOPS                 |                                |     4 |   508 |       |    71   (2)| 00:00:02 |                                                                                                                                                                         
    |* 13 |              HASH JOIN                   |                                |     1 |    68 |       |    44   (3)| 00:00:01 |                                                                                                                                                                         
    |* 14 |               TABLE ACCESS BY INDEX ROWID| SUBJECT_COMPONENT              |    13 |   520 |       |    40   (0)| 00:00:01 |                                                                                                                                                                         
    |* 15 |                INDEX RANGE SCAN          | SUBJECT_COMPONENT_ASSESS_TYPE  |  1059 |       |       |     9   (0)| 00:00:01 |                                                                                                                                                                         
    |* 16 |               INDEX RANGE SCAN           | SUBJECT_GROUP_PK               |    41 |  1148 |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |* 17 |              INDEX RANGE SCAN            | CEA_AUTOMATIC_ALLOCATION_STATS |    30 |  1770 |       |    27   (0)| 00:00:01 |                                                                                                                                                                         
    |* 18 |         SORT JOIN                        |                                |   576 | 41472 |       |  2709   (7)| 00:00:42 |                                                                                                                                                                         
    |  19 |          VIEW                            |                                |   576 | 41472 |       |  2708   (7)| 00:00:42 |                                                                                                                                                                         
    |  20 |           SORT GROUP BY                  |                                |   576 | 21312 |       |  2708   (7)| 00:00:42 |                                                                                                                                                                         
    |* 21 |            HASH JOIN                     |                                | 52408 |  1893K|  1744K|  2701   (7)| 00:00:41 |                                                                                                                                                                         
    |* 22 |             TABLE ACCESS FULL            | IA_INSTANCES                   | 52408 |  1125K|       |  1263   (6)| 00:00:20 |                                                                                                                                                                         
    |  23 |             TABLE ACCESS FULL            | WORKFLOW_INSTANCE              |  1075K|    15M|       |   960   (7)| 00:00:15 |                                                                                                                                                                         
    |* 24 |        TABLE ACCESS BY INDEX ROWID       | PERSON                         |     1 |    27 |       |     1   (0)| 00:00:01 |                                                                                                                                                                         
    |* 25 |         INDEX UNIQUE SCAN                | PERSON_PK                      |     1 |       |       |     0   (0)|          |                                                                                                                                                                         
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
       1 - filter(TO_NUMBER(:V_START_ROW)<=TO_NUMBER(:V_START_ROW)+(TO_NUMBER(:V_MAX_ROW)-1))                                                                                                                                                                                                                   
       2 - filter(("ROW_NUM">=TO_NUMBER(:V_START_ROW) AND "ROW_NUM"<=TO_NUMBER(:V_START_ROW)+(TO_NUMBER(:V_MAX_ROW)-1)))                                                                                                                                                                                        
      13 - access("SC"."SUBJECT"="SG"."SUBJECT" AND "SC"."LVL"="SG"."LVL")                                                                                                                                                                                                                                      
      14 - filter(((:V_SUBJECT IS NULL OR "SC"."SUBJECT"=:V_SUBJECT) AND ("SC"."LVL"=:V_LVL OR :V_LVL IS NULL)))                                                                                                                                                                                                
      15 - access("SC"."YEAR"=TO_NUMBER(:V_YEAR) AND "SC"."MONTH"=:V_MONTH)                                                                                                                                                                                                                                     
      16 - access("SG"."YEAR"=TO_NUMBER(:V_YEAR) AND "SG"."MONTH"=:V_MONTH)                                                                                                                                                                                                                                     
           filter((:V_SUBJECT_GROUP IS NULL OR "SG"."GROUP_NUMBER"=TO_NUMBER(:V_SUBJECT_GROUP)))                                                                                                                                                                                                                
      17 - access("CEA"."YEAR"=TO_NUMBER(:V_YEAR) AND "CEA"."MONTH"=:V_MONTH AND "SC"."PAPER_CODE"="PAPER_CODE" AND                                                                                                                                                                                             
                  "CEA"."ELEMENT"='Moderation of IA')                                                                                                                                                                                                                                                           
           filter(("CEA"."ELEMENT"='Moderation of IA' AND (:V_PADDED_EXAMINER_CODE IS NULL OR                                                                                                                                                                                                                   
                  "EXAMINER_CODE"=:V_PADDED_EXAMINER_CODE)))                                                                                                                                                                                                                                                    
      18 - access("EXNAME"."EXAMINER_CODE"="IAF"."EXAMINER_CODE")                                                                                                                                                                                                                                               
           filter("EXNAME"."EXAMINER_CODE"="IAF"."EXAMINER_CODE")                                                                                                                                                                                                                                               
      21 - access("WFI"."INSTANCE_ID"="IA1"."WORKFLOW_INSTANCE_ID")                                                                                                                                                                                                                                             
      22 - filter(("IA1"."MONTH"=:V_MONTH AND "IA1"."YEAR"=TO_NUMBER(:V_YEAR)))                                                                                                                                                                                                                                 
      24 - filter((:V_EXAMINER_NAME IS NULL OR UPPER("TITLE"||' '||"FIRSTNAME"||' '||"LASTNAME") LIKE :V_SEARCH_EXAMINER_NAME))                                                                                                                                                                                 
      25 - access("EXNAME"."EXAMINER_CODE"="PERSON_CODE")                                                                                                                                                                                                                                                       
    66 rows selected

  • How to read data from flatfile and insert into other relevant tables ? Please suggest me the query ?

    Hi to all,
    I have flat files in different location through FTP i need to fetch those files and load in the relavant table of the database.
    Please share me the query to do it ..

    You would need a ForEach Loop to iterate though the files. Initially the FTP task will pull the files from locations to a landing folder. Once thats done the ForEachLoop will iterate through files in the folder and will have a data flow task inside to transfer
    file data to tables.
    If you want a more secure option you can also use SFTP (Secured FTP) and can implement it using free WinSCP clinet. I've explained a method of doing it fo dynamic files here
    http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html
    for iterating through files see this example
    http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
    you may not need the validation step inside the loop in your case
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Please tell me the query,If i want to fetch before 5 days data into sqlite database in ios ?

    Please tell me the query,If i want to fetch before 5 days data from sqlite database in ios ?

    kumar190 wrote:
    Please Can you send me the link of Sq-lite(Making own Schema). Which will be help full for me...
    Here is the general concept for a database schema: http://en.wikipedia.org/wiki/Database_schema
    This is how you would create a table in SQLite: https://sqlite.org/lang_createtable.html

  • Rewrite the query with out joins and group by

    Hi,
    This was an interview question.
    Table Names: bookshelf_checkout
    bookshelf
    And the join condition between these two tables is title
    We need to rewrite below query without using join condition and group by clause ?
    SELECT b.title,max(bc.returned_date - bc.checkout_date) "Most Days Out"
               FROM bookshelf_checkout bc,bookshelf b
               WHERE bc.title(+)=b.title
               GROUP BY b.title;When I was in college, I read that most of the SELECT statements can be replaced by basic SQL operations (SET OPERATORS). Now I am trying to rewrite the query with SET operators but not able to get the exact result.
    Kindly help me on this.
    Thanks,
    Suri

    Something like this?
      1  WITH books AS (
      2  SELECT 'title 1' title FROM dual UNION ALL
      3  SELECT 'title 2' FROM dual UNION ALL
      4  SELECT 'title 3' FROM dual ),
      5  bookshelf AS (
      6  SELECT 'title 1' title, DATE '2012-05-01' checkout_date, DATE '2012-05-15' returned_date FROM dual UNION ALL
      7  SELECT 'title 1' title, DATE '2012-05-16' checkout_date, DATE '2012-05-20' returned_date FROM dual UNION ALL
      8  SELECT 'title 2' title, DATE '2012-04-01' checkout_date, DATE '2012-05-15' returned_date FROM dual )
      9  SELECT bs.title, MAX(bs.returned_date - bs.checkout_date) OVER (PARTITION BY title) FROM bookshelf bs
    10  UNION
    11  (SELECT b.title, NULL FROM books b
    12  MINUS
    13* SELECT bs.title, NULL FROM bookshelf bs)
    SQL> /
    TITLE   MAX(BS.RETURNED_DATE-BS.CHECKOUT_DATE)OVER(PARTITIONBYTITLE)
    title 1                                                           14
    title 2                                                           44
    title 3Lukasz

  • Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be ab

    Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be able to download the srtony adobe.

    Adobe - Lightroom : For Macintosh
    Hal

  • I'm trying to setup a printer go wireless through my airport extreme, but every time I try to print the printing file gets paused. I'm in loop. PLEASE HELP! (The printer is a Brother 7020  monochrome)

    I'm trying to setup a printer go wireless through my airport extreme, but every time I try to print the printing file gets paused. I'm in loop. PLEASE HELP! (The printer is a Brother 7020  monochrome)

    I had the exact same problem
    It turns out I was using a 20 foot USB cable between the printer and the Airport Extreme and the signal had become to weak to work. Try using nothing more than a 6 foot cable or try a new cable

  • Help wit the query

    I need help with the query
    Here is what I need
    For a particular comm record if there is no Salary record where comm:Date = Salary:Date, then
    • Find maximum dated Salary record as of comm:Date.
    • Clone this record and set Salary:Date = comm:Date
    • Set Salary:rate = comm:rate
    Like wise for a particular Salary record If there is no comm record where Salary:Date = comm:Date then
    • Find maximum effective dated comm record as of Salary:Date
    • Apply Rate 2 amount from this maximum effective dated record to Salary record i.e. Set Salary:rate = comm:rate
    Example
    Salary Table :
    ID Sal_Date Rate Hours
    1 07/01/2011 400.00 40
    2 02/15/2011 200.00 40
    3 01/01/2011 160.00 40
    Sal_comm Table:
    Sal_Date comm_Rate
    1 07/01/2011 10.00
    4 03/01/2011 7.50
    3 01/01/2011 4.00
    I need to merge comm_Rate column in Salary table, since there is no salary record as off 03/01/2011, I need to find the maximum dated salary record as of 03/01/2011
    i.e. the record dated 02/15/2011. Now I need to clone that salary record, set the SAL_date as 03/01/2011 and update Rate2 amount. So the record set will be like:
    Sal_Date:
    id sal_Date Rate Hours comm_Rate
    1 07/01/2011 400.00 40 10.00
    4 03/01/2011 200.00 40 7.50
    2 02/15/2011 200.00 40 4.00
    3 01/01/2011 160.00 40 4.00

    So you need all used dates as the "driving" dataset. And you need the according data for each of these.
    WITH salary_table as
    (select 1 id,to_date('07/01/2011','MM/DD/YYYY')sal_date,400 rate,40 hours from dual union all
    select 2 id,to_date('02/15/2011','MM/DD/YYYY')sal_date,200 rate,40 hours from dual union all
    select 3 id,to_date('01/01/2011','MM/DD/YYYY')sal_date,160 rate,40 hours from dual),
    sal_comm as
    (select 1 id,to_date('07/01/2011','MM/DD/YYYY')sal_date,10 comm_Rate from dual union all
    select 4 id,to_date('03/01/2011','MM/DD/YYYY')sal_date,7.5 comm_Rate from dual union all
    select 3 id,to_date('01/01/2011','MM/DD/YYYY')sal_date,4 comm_Rate from dual)
    select to_char(all_dates.sal_date,'MM/DD/YYYY') sal_date,sal.rate,sal.hours,com.comm_rate
    from (select sal_date from salary_table
          union
          select sal_date from sal_comm) all_dates
    inner join (select s1.*,lead(sal_date-1,1,to_date('31/12/9999','DD/MM/YYYY')) over (order by sal_date) next_sal_date
               from salary_table s1) sal
      on (all_dates.sal_date between sal.sal_date and sal.next_sal_date)
    inner join (select s1.*,lead(sal_date-1,1,to_date('31/12/9999','DD/MM/YYYY')) over (order by sal_date) next_sal_date
               from sal_comm s1) com
      on (all_dates.sal_date between com.sal_date and com.next_sal_date)
    order by   all_dates.sal_date desc;
    SAL_DATE   RATE                   HOURS                  COMM_RATE             
    07/01/2011 400                    40                     10                    
    03/01/2011 200                    40                     7.5                   
    02/15/2011 200                    40                     4                     
    01/01/2011 160                    40                     4                     
         

  • Urgent, please help. why the ListSelectionListener() called twice?

    I had two JList, and every time, I click value in list1, it will call the ListSelectionListener() twice, and when I click on value in List2, it called the list2 actionListener twice also, I don't know why?
    Please help.
    The part of the code list below:
    jList1 = new JList(words1);
    JScrollPane scrollPane1 = new JScrollPane(jList1); jList1.setBackground(Color.lightGray);
    jList1.setBorder(BorderFactory.createLoweredBevelBorder());
    jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
         jList1_valueChanged(e){
    /* add Column_Name to the jList2*/
    JScrollPane scrollPane2 = new JScrollPane(jList2);
    jList2.setBackground(Color.lightGray);
    jList2.setBorder(BorderFactory.createLoweredBevelBorder());
    jList2.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
    jList2_valueChanged(e);
    void jList1_valueChanged(ListSelectionEvent evt)
    void jList2_valueChanged(ListSelectionEvent evt)
    {     }

    You can call ListSelectionEvent.getValueIsChanging() to find out if the selection is in progress or if has been finished. You will get an event both when the user starts the selection (presses the button) and when he/she finishes it (lets go of the betton).
    /Michael

  • I cannot restore my Iphone 4, I keep getting the error code 1611, please help and the Iphone keeps displaying the "Plug-In Itunes Symbol!??

    I cannot restore my Iphone 4, I keep getting the error code 1611, please help and the Iphone keeps displaying the "Plug-In Itunes Symbol!??

    http://tinyurl.com/nyj36v

Maybe you are looking for

  • How to debug variable exit in Bi 7.0

    Hi Experts,       I  have code in variable exit in Bi 7.0, I am trying to debug in RSRT but im not able see my source code, Can you any body suggest me any thing or can suggest me steps to debug variable exit in bi 7.0. Thanks Vinod Kumar

  • Can someone help with auto-size fields in forms?

    I created a form in Acrobat for my team members with auto-size text fields that allow to shrink the text when the field size is not large enough to show the entire text. When I then open the same form file with Adobe Reader on my machine with text th

  • Using ADL when Application.xml and Content.swf are not in the BIN directory

    Hello, I am trying to use the air debug launcher (ADL) to launch a simple air app. My issue is I am trying to have ADL launch this app from outside of the bin directory of the SDK. Whenever I try to pass adl the full path to the Applicaiton.xml file

  • RAM preview HELP!!!

    Why whenever I want to RAM preview always goes full screen even when the full screen (off) uncheck? HELP!!!!

  • Printing problem after acrobat upgrade

    Hi, I am running Mac OSX 10.8.5 and have recently updated my Acrobat to 11.0.04. Since doing this I am experiencing problems printing my pdf files to my desktop printer, which is a Xerox phaser 7500 duplex printer. When sending the file across it jus