When no rows returned in the query loop, replace Null - need help

Hello

I have a requirement where I have a request in the loop for and based on the results of the query, I do some operations.

But even if the query does not match, I should get back something like 'No Data'.

My loop is:

FOR V_SL IN)
SELECT ID, CATEGORY, DI_CD, REV_CD, SL_ID
OF SB, SLOT_2001 S2 SLOT_DATA WHERE
PBM BENEFIT_ID = S2. BENEFIT_ID AND
REV_CD = IN_REV_CD AND
(PROC_CD IS NULL OR PROC_CD = IN_PROC_CD)
ORDER OF DIAGCODE, PROCEDURECODE)
LOOP
END LOOP;

I do some operations inside the loop for. I want the loop to run even if the query returns no rows.

Can someone help me out here.

Thank you
Rambeau

Frank. I am really surprised to see this coming from you. A slider to not find all the lines loop does not cause an exception no_data_found.

Tags: Database

Similar Questions

  • Behavior of the text-to-speech function when any rows returned.

    Hello
    I have problems with a text-to-speech function.
    The summary cell contains this code:
    <? xdofx:If count (ORDXHR) = 0 then 0 else sum (ORDXHR) count (ORDXHR) end if div? >
    She still shows zero, even when the rows are returned.
    It was originally coded like this:
    <? sum (ORDXHR) div (ORDXHR) count? >
    but this version fails when any rows returned.
    Any tips?
    Thank you

    The cell containing two items that are suggested did the trick.
    Thank you!

  • Try to install Service Pack 2 for Windows Vista and it says this "one or more system components that require the service pack are missing" need help?

    Try to install Service Pack 2 for Windows Vista and it says this "one or more system components that require the service pack are missing" need help?

    Hi, Mksethompson,

    What is your model of computer?

    Error message when you try to install Windows Vista Service Pack 2: "one or more system components that require the service pack are missing."

    http://support.Microsoft.com/kb/968279

    Dell issue

    http://en.community.Dell.com/support-forums/software-OS/f/3524/t/19278096.aspx

  • the friends hyii UA HUD need help how to make a backup of the files from his deleted with (shift + delete) memory card

    the friends hyii UA HUD need help how to make a backup of the files from his deleted with (shift + delete) memory card

    Hello

    It seems that you want to restore the files removed from the memory card.

    I will definitely help you with this.

    I would say you can search the Internet for data recovery software by using your favorite search engine.

    Warning: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    It will be useful. If you have any other questions, feel free to let us know. We will be happy to help you.

    Thank you.

  • I have a problem, try to uninstall the ask toolbar. get the error message: cannot access the VB script... need help please

    I have a problem, try to uninstall the ask toolbar. get the error message: unable to access the VB script... need help

    Hello

    How do you try to uninstall the toolbar?

    I would suggest trying the following methods and check if it helps.

    Method 1:

    Try the steps in the following Microsoft article and check if it helps.

    How to fix script errors in Internet Explorer on Windows computers:

    http://support.Microsoft.com/kb/308260

    Correction of errors in Internet Explorer: http://support.microsoft.com/kb/822521

    Method 2:

    Try to uninstall the toolbar, programs and features and check if it helps.

    Uninstall or change a program:

    http://Windows.Microsoft.com/en-us/Windows-Vista/uninstall-or-change-a-program

    Hope the information is useful.

  • Not the rows returned by the spatial query wrapped in SELECT * FROM...

    Hello

    When you run a query with SDO_EQUAL sub, I get a very strange behavior. The SDO_EQUAL query on its own works very well, but if I wrap in SELECT * from there, I get no results. If I wrap SDO_ANYINTERACT in SELECT * from there, I get the expected result.

    It seems like the spatial index is used during the execution of the ordinary, but not when SDO_EQUAL request wrapped in SELECT * FROM. Weird. The spatial index is also not used when SDO_ANYINTERACT is wrapped in SELECT * FROM... so I don't know why that returns the correct answer.

    I get this problem on 11.2.0.2 on Red Hat Linux 64-bit and 11.2.0.1 on Windows XP 32-bit (i.e., all versions of 11g I've tried). The query works as expected on 10.2.0.5 on Windows Server 2003 64-bit.

    Any ideas?

    Confused in Dublin (John)

    Test case...
    SQL> 
    SQL> -- Create a table and insert the same geometry twice
    SQL> DROP TABLE sdo_equal_query_test;
    
    Table dropped.
    
    SQL> CREATE TABLE sdo_equal_query_test (
      2  id NUMBER,
      3  geometry SDO_GEOMETRY);
    
    Table created.
    
    SQL> 
    SQL> INSERT INTO sdo_equal_query_test VALUES (1,
      2  SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
      3  SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
    
    1 row created.
    
    SQL> 
    SQL> INSERT INTO sdo_equal_query_test VALUES (2,
      2  SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
      3  SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
    
    1 row created.
    
    SQL> 
    SQL> -- Setup metadata
    SQL> DELETE FROM user_sdo_geom_metadata WHERE table_name = 'SDO_EQUAL_QUERY_TEST';
    
    1 row deleted.
    
    SQL> INSERT INTO user_sdo_geom_metadata VALUES ('SDO_EQUAL_QUERY_TEST','GEOMETRY',
      2  SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 100000, .0001), SDO_DIM_ELEMENT('Y', 0, 100000, .0001), SDO_DIM_ELEMENT('Z', -100, 4000, .0001))
      3  ,81989);
    
    1 row created.
    
    SQL> 
    SQL> -- Create spatial index
    SQL> DROP INDEX sdo_equal_query_test_spind;
    DROP INDEX sdo_equal_query_test_spind
               *
    ERROR at line 1:
    ORA-01418: specified index does not exist
    
    
    SQL> CREATE INDEX sdo_equal_query_test_spind ON sdo_equal_query_test(geometry) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    
    Index created.
    
    SQL> 
    SQL> -- Ensure data is valid
    SQL> SELECT sdo_geom.validate_geometry_with_context(sdo_cs.make_2d(geometry), 0.0001) is_valid
      2  FROM sdo_equal_query_test;
    
    IS_VALID
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    TRUE
    TRUE
    
    2 rows selected.
    
    SQL> 
    SQL> -- Check query results using sdo_equal
    SQL> SELECT b.id
      2  FROM sdo_equal_query_test a, sdo_equal_query_test b
      3  WHERE a.id = 1
      4  AND b.id != a.id
      5  AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> 
    SQL> -- Check query results using sdo_equal wrapped in SELECT * FROM
    SQL> -- Results should be the same as above, but... no rows selected
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6       AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
      7  );
    
    no rows selected
    
    SQL> 
    SQL> -- So that didn't work.  Now try sdo_anyinteract... this works ok
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6       AND sdo_anyinteract(a.geometry, b.geometry) = 'TRUE'
      7  );
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> 
    SQL> -- Now try a scalar query
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6  );
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> spool off
    Here is the plan of the explain output for the query that works. Note that the spatial index is used.
    SQL> EXPLAIN PLAN FOR
      2  SELECT b.id
      3  FROM sdo_equal_query_test a, sdo_equal_query_test b
      4  WHERE a.id = 1
      5  AND b.id != a.id
      6  AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
    
    Explained.
    
    SQL> @?/rdbms/admin/utlxpls.sql
    
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------
    Plan hash value: 3529470109
    
    ------------------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |                            |     1 |  7684 |     3   (0)| 00:00:01 |
    |   1 |  RESULT CACHE                 | f5p63r46pbzty4sr45td1uv5g8 |       |       |            |       |
    |   2 |   NESTED LOOPS                |                            |     1 |  7684 |     3   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL          | SDO_EQUAL_QUERY_TEST       |     1 |  3836 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS BY INDEX ROWID| SDO_EQUAL_QUERY_TEST       |     1 |  3848 |     3   (0)| 00:00:01 |
    |*  5 |     DOMAIN INDEX              | SDO_EQUAL_QUERY_TEST_SPIND |       |       |     0   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter("B"."ID"!=1)
       4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID")
       5 - access("MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
    ..... other stuff .....     
    Here is the plan of the explain output for the query is not working. Note that the spatial index is not used.
    SQL> EXPLAIN PLAN FOR
      2  SELECT * FROM (
      3     SELECT b.id
      4     FROM sdo_equal_query_test a, sdo_equal_query_test b
      5     WHERE a.id = 1
      6     AND b.id != a.id
      7     AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
      8  );
    
    Explained.
    
    SQL> @?/rdbms/admin/utlxpls.sql
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------
    Plan hash value: 1024466006
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation           | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |                            |     1 |  7684 |     6   (0)| 00:00:01 |
    |   1 |  RESULT CACHE       | 2sd35wrcw3jr411bcg3sz161f6 |       |       |            |          |
    |   2 |   NESTED LOOPS      |                            |     1 |  7684 |     6   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST       |     1 |  3836 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST       |     1 |  3848 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter("B"."ID"!=1)
       4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID" AND
                  "MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
    ..... other stuff .....               

    Yes, this is the bug 9740355. You can get a 11.2.0.1 patch, or wait for 11.2.0.3.

  • Sort order by default of the rows returned by a query

    Hello

    We have a query that returns rows sorted by ascending order on an Oracle 9i server. Example of returned rows.

    879

    Billing account number

    Team account

    ACCT No.

    The action code

    ADMIRE

    Alternative Service instance

    Circuit #.

    Associate Circuit #-2

    Automatic return action

    See BMO Auto

    APR

    We have the same query that returns rows with a random order when ran on an Oracle 11 g database that we plan to upgrade at. example of lines.

    PAIR1 - L02

    Secondary XSLAM of the Board

    The identifier of the current command

    Right stick DSL wholesale

    RICI. PP

    Circuit protection

    For the DSL Service provider contact

    Secondary XSLAM CLLI

    BP1 - L05

    The service status

    MTTR7Indicator

    PAIR2 - L04

    ADMIRE

    Need help

    We demand that the lines to be pre-sorted as 9i to avoid external sort in order by clause. Why is the difference in query returned lines differ between them when tables and indexes that are affected by the query have been matching exactly the other environment.

    Additional information:

    Oracle 9i database character set: AL32UTF8

    Oracle 11 g database character set: WE8MSWIN1252

    Please let me know if you need additional information.

    Thank you!

    If your query is a group, 9i, the Group of the operation has been done as a SORT operation the returned results are sorted.

    10g, the default behavior for the group by being a HASH AGGREGATION, which means that the results are not sorted.

    Support.oracle.com or search google for "_gby_hash_aggregation_enabled", which is a parameter that controls this behavior.

    Hemant K Collette

  • How to limit the number of rows returned in a query

    Hi friends,
    I want to limit the number of rows returned by my request to some 10 lines. How to do this. When I try to make some 6 rows with the rownum < 10 its giving results for a particular Department and that too only... btw I'm bundling my table and includes much a table joins and will order the results of the table by a column... How to do this...

    Run it:

    select * from (your query goes here) where rownum < 10
    

    Nicolas.

  • Returns a record with a 0 if no row is returned by the query

    Hello

    I use oracle 10g.

    Please forgive me if this is a crazy question
    select null ltd, 'aig' company from dual
    where sysdate  = to_date('6/13/2011','mm/dd/yyyy')
    Is it possible to get the following result
    ltd                       company
    null                         aig
    or the following
    ltd           company
    0                aig
    Thanks in advance

    You can use UNION ALL and add line if the query returns nothing.

    WITH T
         AS (SELECT NULL ltd, 'aig' company
               FROM DUAL
              WHERE SYSDATE = TO_DATE ( '6/13/2011', 'mm/dd/yyyy'))
    SELECT * FROM T
    UNION ALL
    SELECT 0 ltd, 'aig' company
      FROM DUAL
     WHERE NOT EXISTS (SELECT * FROM T)
    

    G.

  • error when trying to use ' {' in the query}

    Hello

    The below mentioned query gives error while trying to use ' {'}

    Query:

    Select s, table x (SEM_MATCH)
    "{ ? s RDF: type < http://www.cs.com/sbip/dwh/mdm/data_modeling#Base_Term >.
    ? s? p? x}',
    SEM_Models ('foundation'),
    SEM_RuleBases ('OWLPRIME'),
    SEM_ALIASES (SEM_ALIAS ('dm', 'http://www.cs.com/sbip/dwh/mdm/data_modeling#'),
    ((SEM_ALIAS ('Nice', 'http://www.w3.org/2002/07/owl#')), null, 'INVALID' value))
    where regexp_like (x, 'Customers', 'i');

    Error details:

    ORA-29532: Java call terminated by eception Java exception: oracle.spatial.rdf.server.TokenMgrError: lexical error at line 1, column 1. Met: "{" (123), after:
    ORA-06512: at the 'MDSYS. RDF_MATCH_IMPL_T', line 178
    ORA-06512: at the 'MDSYS. RDF_MATCH_IMPL_T', line 67
    ORA-06512: at line 4 level

    I can't use the query filter Option.

    Any solution?

    Please let me know what I need to apply a patch?

    Note: I use Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

    Kind regards
    Kouadio.

    Hello

    For OPTIONAL in 11.1.0.7.0 support, you need the following patch

    Patch 7600122: SYNTAX of BRACE, VIRTUAL MODELS, NETWORK INDEX AND HINTO SUPPORT FRAME

    Support for filters SPARQL in SEM_MATCH is not available for 11.1.0.7.0. You need version 11.2.0.1.0 or later for the FILTER support. With 11.2.0.1.0, we recommend that you apply our latest game patches:

    Patch 9819833: TECHNOLOGY SEMANTICS 11 G R2 FIX BUNDLE 2

    All of the above fixes are available through My Oracle Support.

    Thank you
    Matt

  • The query on record is missing help

    Thanks in advance

    create the table TABLE_AA1
    (
    A NUMBER,
    PLEASE THE NUMBER,
    NUMBER OF END,
    NUMBER OF TEACHER,
    AVERAGE NUMBER,
    THE REGION NUMBER
    )
    ;


    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (1, 0,.1, 159, 159, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (159, 168, 1 2,.1,.2,);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (3,.2,.3, 179, 159, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (4,.1,.2,, 250, 300, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (5,.2,.3, 320, 250, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (6,.3,.4,, 250, 380, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (7,.2,.3, 388, 379, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (8,.3,.4,, 379, 388, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (9,.4,.5, 388, 400, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (10, 499, 500, 1 1.5,.6,);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (11,.5,.6, 420, 448, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (12,.6,.7, 520, 530, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (13,.7,.8, 540, 550, 1);
    insert into TABLE_AA1 (A, START, END, TEACHER, MEDIUM, REGION)
    values (14,.9, 1, 560, 570, 1);
    commit;

    I have a situation like below

    (1) following query will display the calculation for the first 3 lines - works fine
    (2) if the user pass parameter to eliminate the A = 2 & R_SQUARE = 0.95 and to calculate for the first 3 lines - works fine

    (3) I have a problemn is so user pass the parameter for A = 2

    I want to display eliminate an A = 2 & and R_SQUARE = 0.95 in the second query (as a part of the first 3 rows)

    (No idea or help is appreciated)

    I want the results of the query as below
    A     BEG     END     PROF     AVERAGE     REGION     RN     RN_DESC     R_SQUARE     R_SQUARE_VAL     RANK
    1     0     0.1     159     159     1     1     13               0.956274596     2
    *2     0.1     0.2     159     168     1     
    3     0.2     0.3     179     159     1     2     12               0.956274596     2
    4     0.1     0.2     250     300     1     3     11     0.956274596     0.956274596     2
    5     0.2     0.3     320     250     1     4     10               0.018818382     1
    6     0.3     0.4     250     380     1     5     9               0.018818382     1
    7     0.2     0.3     388     379     1     6     8     0.018818382     0.018818382     1
    (1) first query works Fine
    SELECT d.*,DENSE_RANK() OVER (/*PARTITION BY r_square_val*10*/ ORDER BY R_SQUARE_VAL) RANK
    FROM   (SELECT c.*, last_value(r_square ignore nulls) over (order by rn_desc) r_square_val
            FROM   (SELECT a.*,
                           REGR_R2 (average, prof) OVER (ORDER BY rn
                                                         ROWS BETWEEN CASE WHEN MOD (rn, 3) = 0
                                                                                THEN 3
                                                                           WHEN rn_desc = 1
                                                                                THEN  MOD (rn, 3)
                                                                           ELSE  0
                                                                      END  PRECEDING
                                                               AND CURRENT ROW) AS r_square 
                    FROM   (select b.*,
                                   row_number() over (partition by  region order by b.a) rn,
                                   row_number() over (partition by  region order by b.a desc) rn_desc
                            from   table_aa1 b
                            /*where  b.a != 2*/
                                                                ) a) c) d
    /*where trunc(r_square_val, 2) = 0.01*/
    ORDER BY  d.region asc ,d.a asc;
    A     BEG     END     PROF     AVERAGE     REGION     RN     RN_DESC     R_SQUARE     R_SQUARE_VAL     RANK
    -------------------------------------------------------------------------------------------------------
    1     0     0.1     159     159     1     1     14               0.25          3
    2     0.1     0.2     159     168     1     2     13               0.25          3
    3     0.2     0.3     179     159     1     3     12     0.25          0.25          3
    4     0.1     0.2     250     300     1     4     11               0.164520715     1
    5     0.2     0.3     320     250     1     5     10               0.164520715     1
    6     0.3     0.4     250     380     1     6     9     0.164520715     0.164520715     1
    7     0.2     0.3     388     379     1     7     8               0.218256852     2
    8     0.3     0.4     379     388     1     8     7               0.218256852     2
    9     0.4     0.5     388     400     1     9     6     0.218256852     0.218256852     2
    10     1.5     0.6     499     500     1     10     5               0.973538061     4
    11     0.5     0.6     420     448     1     11     4               0.973538061     4
    12     0.6     0.7     520     530     1     12     3     0.973538061     0.973538061     4
    13     0.7     0.8     540     550     1     13     2               1          5
    14     0.9     1     560     570     1     14     1     1          1          5
    (2) request works very well
    If the user pass parameter to remove the A = 2 and R_SQUARE = 0.95 calculate for the first 3 lines - works fine
    SELECT d.*,DENSE_RANK() OVER (/*PARTITION BY r_square_val*10*/ ORDER BY R_SQUARE_VAL) RANK
    FROM   (SELECT c.*, last_value(r_square ignore nulls) over (order by rn_desc) r_square_val
            FROM   (SELECT a.*,
                           REGR_R2 (average, prof) OVER (ORDER BY rn
                                                         ROWS BETWEEN CASE WHEN MOD (rn, 3) = 0
                                                                                THEN 3
                                                                           WHEN rn_desc = 1
                                                                                THEN  MOD (rn, 3)
                                                                           ELSE  0
                                                                      END  PRECEDING
                                                               AND CURRENT ROW) AS r_square 
                    FROM   (select b.*,
                                   row_number() over (partition by  region order by b.a) rn,
                                   row_number() over (partition by  region order by b.a desc) rn_desc
                            from   table_aa1 b
                            where  b.a != 2
                                                                ) a) c) d
    where trunc(r_square_val, 2) <= 0.95
    ORDER BY  d.region asc ,d.a asc;
    A     BEG     END     PROF     AVERAGE     REGION     RN     RN_DESC     R_SQUARE     R_SQUARE_VAL     RANK
    1     0     0.1     159     159     1     1     13               0.956274596     2
    3     0.2     0.3     179     159     1     2     12               0.956274596     2
    4     0.1     0.2     250     300     1     3     11     0.956274596     0.956274596     2
    5     0.2     0.3     320     250     1     4     10               0.018818382     1
    6     0.3     0.4     250     380     1     5     9               0.018818382     1
    7     0.2     0.3     388     379     1     6     8     0.018818382     0.018818382     1
    Published by: user1849 on September 8, 2009 09:02

    Published by: user1849 on September 8, 2009 09:14

    Published by: user1849 on September 8, 2009 09:17

    You don't think the my last request everything works very well for your needs:

    Look carefully

    with req_data as
    (
        SELECT
            d.*
        ,   DENSE_RANK() OVER (ORDER BY R_SQUARE_VAL) RANK
        FROM
            (SELECT
                c.*
            ,   last_value(r_square ignore nulls) over (order by rn_desc) r_square_val
            FROM
                (SELECT
                    a.*
                ,   REGR_R2 (average, prof) OVER (ORDER BY rn ROWS BETWEEN
                                                                        CASE WHEN MOD (rn, 3) = 0 THEN 3
                                                                             WHEN rn_desc = 1 THEN MOD (rn, 3)
                                                                             ELSE 0
                                                                        END PRECEDING
                                                                    AND CURRENT ROW) AS r_square
                FROM
                    (select
                        b.*
                    ,   row_number() over (partition by region order by b.a) rn
                    ,   row_number() over (partition by region order by b.a desc) rn_desc
                    from
                        table_aa1 b
                    where
                        b.a not in (select d.a from table_aa1 d where d.a in(2,6))) a
                ) c
            ) d
        where
            trunc(r_square_val, 2) <= 0.49
    )
    select
        *
    from
    (
        select
            *
        from
            req_data
        union all
        select
            m.*
        ,   to_number(null) r_square
        ,   to_number(null) r_square_val
        ,   to_number(null) RANK
        from
        (
            select
                b.*
            ,   row_number() over (partition by region order by b.a) rn
            ,   row_number() over (partition by region order by b.a desc) rn_desc
            from
                table_aa1 b
        ) m
       where m.a in (2, 6)
       and exists
               (select
                    1
                from
                    (select
                        max(r.a) mx
                    ,   min(r.a) mn
                    from
                        req_data r
                    )
                where
                    m.a between mn and mx
                )
    ) x
    ORDER BY
        x.region asc
    ,   x.a asc;
    

    As a result of output product

    5     0.2     0.3     320     250     1     4     9               0.496965785     1
    6     0.3     0.4     250     380     1
    7     0.2     0.3     388     379     1     5     8               0.496965785     1
    8     0.3     0.4     379     388     1     6     7     0.496965785     0.496965785     1
    

    Kind regards
    Amit

  • I have an account and have paid for an upgrade of Adobe Acrobat which when I re - download tells me that I don't have the correct serial number - I need help

    I have an account and have paid for an upgrade of Adobe Acrobat which when I re - download tells me that I have no serial number correct - I need help and am going in circles using the Adobe site - I spent hours trying to get help

    you're right about s/n Oops! It was the latest version that I downloaded on the site last week - Acrobat X Standard, that's what I had bought before, and s/n does not. I changed computers and need to download again on the site and at the beginning of all this trouble. I couldn't see an Acrobat X - just the Acrobat 9... I myself am confused! I will go back and check again... Thanks for all your help with this!

  • Accidentally, I purchase an upgrade when I was trying to buy Acrobat Pro. I need help in Exchange for the upgrade to what I need.

    I can't find a certain number of support the customer to solve this problem.

    You can contact the Support from Adobe using link below:

    Contact the customer service

    [Click on always need help button and select the Chat option]

  • What is the problem with this request - need help

    Requirement: need to get the names of the employees who were hired Tuesday it must use the function to_char

    Select ename
    WCP
    where to_char (hiredate, 'day') = "Tuesday";

    When I run the query
    o/p is without selected lines

    Help, please.

    Thanks in advance.

    Hello

    861173 wrote:
    Requirement: need to get the names of the employees who were hired Tuesday it must use the function to_char

    Select ename
    WCP
    where to_char (hiredate, 'day') = "Tuesday";

    When I run the query
    o/p is without selected lines

    Try:

    WHERE   TO_CHAR (hiredate, 'fmday')  = 'tuesday'
    

    Without "FM" in the 2nd argument, TO_CHAR pads the results to make a uniform length. If your NLS_DATE_LANGUAGE = ENGLISH, which means it will always return a string of 9 characters, as the longest name in English ("Wednesday") has 9 letters. "FM" (case-insernsitive) tells TO_CHAR does not add this kind of padding.

  • FILE, DENYING ME ACCESS BECAUSE I MESSED UP WITH THE PERMISSION... NEED HELP BAD!

    *) I am the only user on my pc, which makes me the administrator... but I kept the user invited on just incase some friends want to use my pc... (but nobody used my vista yet)

    *) I recently changed my folder access authorization in the secutiry tab in the properties of a folder. to try how it works

    *) accidentally refused "user {(REZ-PC\User)"think the guest profile won't be able to access the folder.} ". but now it seems I can't use it myself...

    *) I HAV to manually goto each and ever forlder and goto Security tab, so let me use... but it is a VERY LONG process because there are tons of folders inside...

    need help please tell me a way qucick to solve this problem... If you want more information, just tell me ill add them... Thank you all...

    Hello

    You can restore the computer to the date when it was working fine

    1. Click Start, type system restore in the search box, and then click System Restore in the list programs.

    2. in the System Restore dialog box, click on choose a different restore point and then click Next.

    3. in the list of restore points, choose a restore point and then click Next.

    4. click on finish.

    http://support.Microsoft.com/kb/936212

Maybe you are looking for

  • Firewall, yes or no?

    I got my iMac 10.9.5 yesterday for crashing issues, they said there is no problems of material and thought It would be better to do a reinstall of the operating system (maverick) when we look through that firewall security is turned off, do I need th

  • other applications will not start under firefox

    Since FF10 was installed on my Win7 64 bit system, none of the applications that used to be able to launch firefox can do. 2 include sylpheed (who is preparing to launch the default browser) and rssowl (set in the same way). Why?

  • Satellite L655 - 14 d - how to restore factory settings?

    Hello, I'm Ali. I have the Toshiba Satellite L655 - 14 d. I have format my laptop and repartition the HARD disk and reinstall Windows 7 from disc and I already save folder HDDrecovery...Now, how can I restore my laptop to factory settings? I hope to

  • HP Mini 110-116NR VP363UA #ABA: HP Mini 110-1116NR CURRENT password problem

    Hello A friend gave me a computer recently but could not remember the BIOS password. (The computer has recently received a new hard drive because of the failure of the original). When it starts, it asks a current password. I tried all the passwords I

  • Black screen on Protectsmart

    I just bought a hp protectsmart... and now the screen is all black suddenly... He is running... and there is a light on the caps lock button every 3 seconds... What can be wrong?