sdo_inside - results vary according to the number of input lines

Hello

... Using the Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production on Linux 64-bit...

When I use SDO_INSIDE to find the 8 million points inside 30 000 polygons of postal code, I get the expected results, with the exception of 10 items that are duplicated in the results of each point being assigned to two different zip codes.

When I change the where clause to use only 10 points in question, then SDO_INSIDE will return the correct results.

Tables of point and polygon validates without errors. Does anyone have an explanation for this behavior?

Thanks for your help,
David
SQL> explain plan for
  2  create table custom.out_table nologging
  3  as
  4  select
  5    a.blc_gcode blc_gcode, b.postcode postcode, '1' maskflag
  6  from
  7    custom.bnd_zip_2012_03 b,
  8    xref2012.aux_01_blc a
  9  where
 10    sdo_inside(a.geom, b.geom) = 'TRUE';

Explained.

SQL>
SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
Plan hash value: 2405185576

-----------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name                | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------------------------
|   0 | CREATE TABLE STATEMENT        |                     |  2424M|   212G|  3853K  (1)| 19:15:56 |
|   1 |  LOAD AS SELECT               | OUT_TABLE           |       |       |         |          |
|   2 |   NESTED LOOPS                |                     |  2424M|   212G|213   (1)| 00:00:04 |
|   3 |    TABLE ACCESS FULL          | BND_ZIP_2012_03     | 30241 |   502K|213   (1)| 00:00:04 |
|   4 |    TABLE ACCESS BY INDEX ROWID| AUX_01_BLC          | 80177 |  6028K|213   (1)| 00:00:04 |
|*  5 |     DOMAIN INDEX              | AUX_01_BLC_GEOM_IDX |       |       |  0   (0)| 00:00:01 |
-----------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   5 - access("MDSYS"."SDO_INSIDE"("A"."GEOM","B"."GEOM")='TRUE')

17 rows selected.

SQL>
find duplicates:
SQL> select a.blc_gcode, a.postcode, a.maskflag
  2  from
  3    out_table a,
  4    (select
  5    blc_gcode, count (blc_gcode) cnt
  6    from out_table
  7    group by blc_gcode) b
  8  where a.blc_gcode = b.blc_gcode and b.cnt > 1
  9  order by a.blc_gcode;

BLC_GCODE       POSTCODE                  MASKFLAG
--------------- ---------------------------------------- ---------------
131150017011025 30125                     1
131150017011025 30104                     1
131150017011029 30125                     1
131150017011029 30104                     1
131150017011030 30104                     1
131150017011030 30125                     1
131150017011031 30104                     1
131150017011031 30125                     1
132339901003004 30125                     1
132339901003004 30173                     1
132339901003006 30125                     1
132339901003006 30104                     1
132339901003007 30125                     1
132339901003007 30104                     1
132339901003017 30104                     1
132339901003017 30125                     1
132339901003019 30104                     1
132339901003019 30125                     1
482299501002426 79837                     1
482299501002426 79839                     1

20 rows selected.

SQL>
Re-test the duplicates only:
SQL> select
  2    a.blc_gcode, b.postcode, '1' maskflag
  3  from
  4    custom.bnd_zip_2012_03 b,
  5    xref2012.aux_01_blc a
  6  where
  7    a.blc_gcode IN
  8    ('131150017011025','131150017011029',
  9    '131150017011030','131150017011031',
 10    '132339901003004','132339901003006',
 11    '132339901003007','132339901003017',
 12    '132339901003019','482299501002426')
 13    AND
 14    sdo_inside(a.geom, b.geom) = 'TRUE';

BLC_GCODE       POSTCODE                  MASKFLAG
--------------- ---------------------------------------- --------------
131150017011025 30104                     1
131150017011029 30104                     1
131150017011030 30104                     1
131150017011031 30104                     1
132339901003004 30173                     1
132339901003006 30104                     1
132339901003007 30104                     1
132339901003017 30104                     1
132339901003019 30104                     1
482299501002426 79839                     1

10 rows selected.

SQL>

Hi David,

I tested the ZIP code = (30104, 30125) with 10 points.
I ran the same query (as below) both 11.2.0.2 and 11.2.0.3:

SQL> select a.blc_gcode blc_gcode, b.postcode postcode from bnd_zip_2012_03 b, aux_01_blc a where sdo_inside(a.geom, b.geom) = 'TRUE';

11.2.0.2, I learned

         BLC_GCODE             POSTCODE
-------------------------- --------------------------
       131150017011031            30104
       131150017011029            30104
       131150017011025            30104
       131150017011030            30104
       132339901003019            30104
       132339901003006            30104
       132339901003007            30104
       132339901003017            30104
       131150017011031            30125
       131150017011029            30125
       131150017011025            30125
       131150017011030            30125
       132339901003004            30125
       132339901003019            30125
       132339901003006            30125
       132339901003007            30125
       132339901003017            30125
17 rows selected.

On 11.2.0.3, I got

         BLC_GCODE             POSTCODE
-------------------------- --------------------------
       131150017011031            30104
       131150017011029            30104
       131150017011025            30104
       131150017011030            30104
       132339901003019            30104
       132339901003006            30104
       132339901003007            30104
       132339901003017            30104
8 rows selected.

This is so the bug 12724515. Please either get 11.2.0.3 or
ask the oracle support to obtain the fix for bug 12724515.

Why your 10-point query shows the correct results?

select
  2    a.blc_gcode, b.postcode, '1' maskflag
  3  from
  4    custom.bnd_zip_2012_03 b,
  5    xref2012.aux_01_blc a
  6  where
  7    a.blc_gcode IN
  8    ('131150017011025','131150017011029',
  9    '131150017011030','131150017011031',
 10    '132339901003004','132339901003006',
 11    '132339901003007','132339901003017',
 12    '132339901003019','482299501002426')
 13    AND
 14    sdo_inside(a.geom, b.geom) = 'TRUE';

This is because the two motions are different. For example, the
top query most likely chooses an index on blc_gcode and sdo_inside
is run by function (i.e. a line a line). In your query
with erroneous results, sdo_inside is run by a spatial index, i.e.
you see the following execution plan:

|   0 | SELECT STATEMENT             |                  |
|   1 |  NESTED LOOPS                |                  |
|   2 |   TABLE ACCESS FULL          | BND_ZIP_2012_03  |
|   3 |   TABLE ACCESS BY INDEX ROWID| AUX_01_BLC       |
|*  4 |    DOMAIN INDEX              | SPATIAL_IDX      |

Thank you
Ying

Tags: Database

Similar Questions

  • Column data reading according to the number of lines

    Hi guys,.

    I am currently stuck on the problem of recovering the data from my database (MS Access) according to the number of lines, he has at any time (without having to know how many lines there will be during the programming of this part).

    First, I show how my program works. I'm working on an automated food, order and after the customer has chosen his power, system information such as the name of the food, quantity and price of the food will be written to the MS Access database table. (for example table name "Orderingtable" in MS Access) For my case, 1 order of food will occupy 1 line of the database table. In other words, as part of the same, if he orders 3 different foods, 3 rows will be filled in my database table.

    I would then get the part number of 'Quantity' for each order of the database and summarize the amount finally to count the total number of orders in the table of database at any time. This addition of result will be then shown on the Panel before informing the customer how many orders waiting's just prior to his order. In this case, it can get out if he wants to, if the number of orders is too big for its waiting time.

    However, I do not know how many lines my 'Orderingtable' will be 'Orderingtable' because both accumulate lines and data lines until being command to remove. Therefore, I cannot predict how many lines I program the party totals the number of quantity for each line.

    Is it possible that I can get the part of the 'quantity' without having to know the number of rows in the database so that I can count the total number of pending orders just by adding up the value of the quantity for each line?

    I do not wish to "code" my program by limiting the tables of database for us are going to say, only 50 lines at any time.

    Attached below, this is how my database table "Orderingtable" looks at, which will be used to extract the 'Quantity' column so that it can count the total number of orders and be shown/shown on the front panel of my Labview program.

    I hope that you are able to help me!

    Thank you so much in advance.

    See you soon,.

    MUI

    You can also use the SUM function:

    SELECT SUM (Quantity) OF the order WHERE Queue_No = %d

    And no need of an "Order By" clause, if you add just the quantities.

  • Update from the field with consecutive number according to the number of entries

    Hello

    I need to update a field with a consecutive number according to the number of lines where the entries are made which go hand in hand. What it means:
    I have
    SYSAUSPR AREA SYSGEBIET TYP RANG
    182925 600003 4 1 PERSON
    1 600004 4 1 PERSON
    2 600004 4 1 PERSON
    3 600004 4 1 PERSON
    17 600004 4 1 PERSON
    18 600022 4 1 PERSON
    182864 600079 4 1 PERSON
    184082 600092 4 1 PERSON
    182774 600143 4 1 PERSON
    PERSON 183237 600165 4 1
    NO 7 600169 4 1
    8 600169 4 1 PEOPLE
    9 600169 4 1 PERSON
    12 600169 4 1 PEOPLE
    14 600169 4 1 PERSON
    184309 600179 4 1 PERSON
    23 600182 4 1 PERSON

    I need to change column "RANK" of 1 the number of records that have the same id in the "SYSGEBIET" column (from this example with 600) so that it looks like

    SYSAUSPR AREA SYSGEBIET TYP RANG
    182925 600003 4 1 PERSON
    1. NOBODY 600004 4 * 1 *.
    2. PERSON 600004 4 * 2 *.
    3. PERSON 600004 4 * 3 *.
    17. NO 600004 4 * 4 *.
    18. NO 600022 4 * 1 *.

    Does anyone has an idea how to solve this problem in an update statement?
    Thanks for your help
    Best regards
    Carsten
    SQL> select  *
      2    from  tbl
      3  /
    
      SYSAUSPR GEBIET  SYSGEBIET        TYP       RANG
    ---------- ------ ---------- ---------- ----------
             1 PERSON     600004          4          1
             2 PERSON     600004          4          1
             3 PERSON     600004          4          1
            17 PERSON     600004          4          1
            18 PERSON     600022          4          1
        182864 PERSON     600079          4          1
        184082 PERSON     600092          4          1
        182774 PERSON     600143          4          1
        183237 PERSON     600165          4          1
             7 PERSON     600169          4          1
             8 PERSON     600169          4          1
    
      SYSAUSPR GEBIET  SYSGEBIET        TYP       RANG
    ---------- ------ ---------- ---------- ----------
             9 PERSON     600169          4          1
            12 PERSON     600169          4          1
            14 PERSON     600169          4          1
        184309 PERSON     600179          4          1
            23 PERSON     600182          4          1
    
    16 rows selected.
    
    merge
      into tbl t
      using (
             select  sysgebiet,
                     sysauspr,
                     row_number() over(partition by sysgebiet order by sysauspr) rang
               from  tbl
               where sysgebiet like '600%'
            ) u
        on (
                u.sysgebiet = t.sysgebiet
            and
                u.sysauspr = t.sysauspr
           )
      when matched
        then update set t.rang = u.rang
    /
    
    16 rows merged.
    
    SQL> select  *
      2    from  tbl
      3  /
    
      SYSAUSPR GEBIET  SYSGEBIET        TYP       RANG
    ---------- ------ ---------- ---------- ----------
             1 PERSON     600004          4          1
             2 PERSON     600004          4          2
             3 PERSON     600004          4          3
            17 PERSON     600004          4          4
            18 PERSON     600022          4          1
        182864 PERSON     600079          4          1
        184082 PERSON     600092          4          1
        182774 PERSON     600143          4          1
        183237 PERSON     600165          4          1
             7 PERSON     600169          4          1
             8 PERSON     600169          4          2
    
      SYSAUSPR GEBIET  SYSGEBIET        TYP       RANG
    ---------- ------ ---------- ---------- ----------
             9 PERSON     600169          4          3
            12 PERSON     600169          4          4
            14 PERSON     600169          4          5
        184309 PERSON     600179          4          1
            23 PERSON     600182          4          1
    
    16 rows selected.
    
    SQL> 
    

    SY.

  • During installing After Effects CS6, after the number of input series - report «we are unable to validate the serial number for Adobe After Effects CS6.» Please contact the support. »

    During installing After Effects CS6, after the number of input series - report «we are unable to validate the serial number for Adobe After Effects CS6.» Please contact the support. »

    What are the blocker of Adobe which affects the serial number validation processes.

    Follow the procedure below:

    • Remove all entries that has name of adobe. Then close the Textedit, it will Autosave.
    • Make sure that there is no entry of Adobe on the inside.
    • Then copy and paste the Hosts file in folder etc.
    • We replace the modified hosts file that we had copied on the desktop with the original Hosts file inside the folder etc.
    • When you are prompted, the authentication by password Mac,
    • Be sure to select the option Replace ...
    • Once you have replaced the Hosts file, double click on it again and check if the Hosts file is free of Adobe entries.

    Then try to activate the CS 6 apps using the serial number, it shud work.

    Let me know if you face any problem.

  • How can I fix the height of the datagrid advance according to the number of lines.

    Hello

    I have a datagrid move with a few lines in it. But the height of the grid is higher than the number of lines... How can I fix the height number of lines. That is, if the number of lines is 5 then the height shall be determined in accordance with that.

    Can someone please tell me a solution for this.

    Thank you

    Suma.

    Set rowCount is equal to the length of the dataProvider:

    
    
      
        
      
      
        
          
          
          
          
            
            
          
        
      
    
    
    [Bindable]
    private var dpFlat:ArrayCollection = new ArrayCollection([
      {Region:"Southwest", Territory:"Arizona",
          Territory_Rep:"Barbara Jennings", Actual:38865, Estimate:40000},
      {Region:"Southwest", Territory:"Arizona",
          Territory_Rep:"Dana Binn", Actual:29885, Estimate:30000},
      {Region:"Southwest", Territory:"Central California",
          Territory_Rep:"Joe Smith", Actual:29134, Estimate:30000},
      {Region:"Southwest", Territory:"Nevada",
          Territory_Rep:"Bethany Pittman", Actual:52888, Estimate:45000},
      {Region:"Southwest", Territory:"Northern California",
          Territory_Rep:"Lauren Ipsum", Actual:38805, Estimate:40000},
      {Region:"Southwest", Territory:"Northern California",
          Territory_Rep:"T.R. Smith", Actual:55498, Estimate:40000},
      {Region:"Southwest", Territory:"Southern California",
          Territory_Rep:"Alice Treu", Actual:44985, Estimate:45000},
      {Region:"Southwest", Territory:"Southern California",
          Territory_Rep:"Jane Grove", Actual:44913, Estimate:45000}
    ]);
    

    If this post answers your question or assistance, please mark it as such. Thank you!

    http://www.stardustsystems.com
    Adobe Flex development and Support Services

  • development of the column according to the number of months in the quarter

    Hi all

    My need is to calculate the lines and write the result in the column:
    C1, if the current month is the 1st quarter,
    C2 if the current month is the 2nd quarter
    C3, if the current month is the 3rd quarter.

    How can I make it?

    Update: for example, today is August, this is the second month in the neighborhood, so I should write my value in C2.

    Published by: marco on 08/01/2011 07:43

    Marco wrote:
    BluShadow, Yes, this is one of the following ways.
    But what happens if I do not have the result column?

    You have not provided us with more information. My putting "train" there is for you to replace everything that you need need generate your result, to the extent that comes.
    Our crystal balls are broken right now, then, how you calculate your result belongs to you. the only thing you told us is that you calculate 'lines' for a 'result '.

    With regard to what you were actually asking however know how to differentiate which column to put the result in, this question has been answered.

  • Column with the number of Partition lines or program group?

    Hi all

    I wish I had a column in my query that indicates how many rows in each partition/group. I hope that my code is clear. Everyone would be Kow how do I do this? I'm pretty eager to avoid nesting if I can because it is already part of a larger and more complex query.

    Be grateful for any help, I'm a little confused!

    Thank you

    Jon

    Select
    d.deal_id,
    c.class_id,
    c.Seniority,
    ROW_NUMBER () OVER (PARTITION BY d.deal_id ORDER BY c.seniority ASC, ASC c.class_id) DealClassCount,.
    -I want the number of Classes per case here, max DealClassCount (the value is the same on all rows of the agreement).
    decode (ROW_NUMBER () OVER (PARTITION BY d.deal_id ORDER BY c.seniority ASC, asc c.class_id), 1,1,0) DealSum
    global_sf.deal d, global_sf.class c
    where d.deal_id = c.deal_id

    and d.deal_id in
    (
    '87354694'
    '87355187'
    )

    order of d.deal_id, c.class_id, c.seniority

    Hi, Jon,

    It would really help, whenever you have any questions, post a few examples of data (CREATE TABLE and INSERT statements) and the results desired from these data. This makes it much more clearly what you want to do.
    If you don't want to show all the data, use the tables commonly available (like those of the scott schema) of your DIF,.

    I think you want to use the COUNT function Analytics (without ORDER BY clause) instead of ROW_NUMBER.

    SELECT    deptno
    ,         ename
    ,         COUNT (*) OVER (PARTITION BY deptno)  AS dept_total
    FROM      scott.emp
    ORDER BY  deptno
    ;
    

    Output:

    `   DEPTNO ENAME      DEPT_TOTAL
    ---------- ---------- ----------
            10 CLARK               3
            10 KING                3
            10 MILLER              3
    
            20 JONES               5
            20 FORD                5
            20 ADAMS               5
            20 SMITH               5
            20 SCOTT               5
    
            30 WARD                6
            30 TURNER              6
            30 ALLEN               6
            30 JAMES               6
            30 BLAKE               6
            30 MARTIN              6
    
  • splitting things according to the number of quantities

    Dear expert;

    I have the sample data below
    create table t3
    (
           ID varchar2(1000),
           qty number(30),
           place varchar(1000)
    );
    
    
    
    insert into t3
      (id, qty, place)
    values
      ('A1,A2', 3, 'UK');
    insert into t3
      (id, qty, place)
    values
      ('C1,C2', 5, 'GERMANY'); 
    insert into t3
      (id, qty, place)
    values
      ('C6,C7', 1, 'MEXICO');
    insert into t3
      (id, qty, place)
    values
      ('C10,C12', 4, 'FRANCE');
    insert into t3
      (id, qty, place)
    values
      ('C13,C14', 4, 'USA');
    the output I want below

    PLACE OF THE ID
    A1, A2 UK
    A1, A2 UK
    A1, A2 UK
    C1, C2 GERMANY
    C1, C2 GERMANY
    C1, C2 GERMANY
    C1, C2 GERMANY
    C1, C2 GERMANY
    C6, C7 MEXICO
    C10, C12, FRANCE
    C10, C12, FRANCE
    C10, C12, FRANCE
    C10, C12, FRANCE
    C13, C14 USA
    C13, C14 USA
    C13, C14 USA
    C13, C14 USA

    that I want to record in a table. Any help is appreciated. Thank you.

    Hello

    Sorry, I thought that it works in Oracle 9.
    It really works in Oracle 9.2.0.6.0:

    WITH     cntr        AS
    (
         SELECT  LEVEL  AS n
         FROM     (
                         SELECT  MAX (qty)     AS max_qty
                   FROM    t3
                     )
         CONNECT BY     LEVEL <= max_qty
    )
    SELECT    t3.id
    ,       t3.place
    FROM       t3
    JOIN       cntr     c  ON   c.n     <= t3.qty
    ;
    
  • assign the number to a line based on the analytical condition function

    Oracle 11g Server

    ID val1 val2
    100a
    110 b
    120c
    200a
    220 b

    WITH input AS
     (SELECT 1  id
            ,0  val1
            ,'0a' val2
        FROM dual
      UNION ALL
      SELECT 1  id
            ,1  val1
            ,'0b' val2
        FROM dual
      UNION ALL
      SELECT 1  id
            ,2  val1
            ,'0c' val2
        FROM dual
      UNION ALL
      SELECT 2  id
            ,0  val1
            ,'0a' val2
        FROM dual
      UNION ALL
      SELECT 2     Id
            ,2val1
            ,'0b'    val2
        FROM dual)
    SELECT * FROM input;
    
    !-[CodeBlockEnd:ae52826b-04c5-4aa4-a6c0-1d0405656e55]-->

    Output:

    ID val1 val2 assigned_number
    100a0
    110 b0
    120c2
    200a0
    220 b1

    The dense numbering sequence must be assigned to each line based on the column id and val1.

    For an identifier given, the numbering begins only after val1 > 1 until then the assigned_number will be zero.

    WITH the entry INTO

    (SELECT 1 id)

    0 val1

    '0' has val2

    OF the double

    UNION ALL

    SELECT 1 id

    1 val1

    b '0' val2

    OF the double

    UNION ALL

    SELECT 1 id

    2 val1

    , 0'c ' val2

    OF the double

    UNION ALL

    SELECT 2 id

    0 val1

    '0' has val2

    OF the double

    UNION ALL

    SELECT the Id 2

    2val1

    b '0' val2

    THE DOUBLE)

    SELECT id, val1, val2,

    Rank() over (partition by order of case when val1 > 1 then 0 otherwise end val1) dr-1

    SINCE the entry;

    ID VAL1 IS DR

    ---------- ---------- -- ----------

    1          0 0a          0

    1          1 0b          0

    1          2 0c          2

    2          0 0a          0

    2          2 0b          1

  • Creating a view using multiple joins - by reducing the number of output lines

    It is difficult to put into words exactly what I want to implement, so I'll just use an example. Let's say I have the following database:

    game (id, time, place)

    Reader (game_id, name)

    Referee (game_id, name)

    Foreign keys:
    Player (game_id) references game (id)
    Referee (game_id) references game (id)

    It is a very special match, in which:
    A game can have 1 to many players
    A game can have from 1 to several arbitrators

    I want to create the following view:

    Game_overview (Game_id, time, player, referee)

    It's easy to create this view with the following output:

    Game1, 15:00, player1, Referee1
    Game1, 15:00, player1, Referee2
    Game1, 15:00, player2, Referee1
    Game1, 15:00, player2, Referee2
    Game1, 15:00, Joueur3, null
    08:00, player1, Referee1, GaMe2
    GaMe2, 08:00, player1, Referee2

    HOWEVER, I want it to look like this:

    Game1, 15:00, player1, Referee1
    Game1, 15:00, player2, Referee2
    Game1, 15:00, Joueur3, null
    08:00, player1, Referee1, GaMe2
    GaMe2, 08:00, null, Referee2

    I think that this should not be TOO difficult to solve, but I can't really get my head around it.

    Welcome to the forum!

    Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data. Sinve it's your first post, I'll do it for you:

    CREATE TABLE     game
    (       id          VARCHAR2 (10)     PRIMARY KEY
    ,     time          VARCHAR2 (10)
    --,     location     VARCHAR2 (10)     -- No need to include columns that play no role in this problem
    );
    
    INSERT INTO game (id, time) VALUES ('Game 1',  '3PM');
    INSERT INTO game (id, time) VALUES ('Game 2',  '8AM');
    
    CREATE TABLE     player
    (       game_id          VARCHAR2 (10)
    ,     name          VARCHAR2 (10)
    );
    
    INSERT INTO  player (game_id, name) VALUES ('Game 1',  'Player 1');
    INSERT INTO  player (game_id, name) VALUES ('Game 1',  'Player 2');
    INSERT INTO  player (game_id, name) VALUES ('Game 1',  'Player 3');
    INSERT INTO  player (game_id, name) VALUES ('Game 2',  'Player 1');
    
    CREATE TABLE     referee
    (       game_id          VARCHAR2 (10)
    ,     name          VARCHAR2 (10)
    );
    
    INSERT INTO  referee (game_id, name) VALUES ('Game 1',  'Referee 1');
    INSERT INTO  referee (game_id, name) VALUES ('Game 1',  'Referee 2');
    INSERT INTO  referee (game_id, name) VALUES ('Game 2',  'Referee 1');
    INSERT INTO  referee (game_id, name) VALUES ('Game 2',  'Referee 2');
    

    In this way, people who want to help you can recreate the problem and test their ideas.

    In addition, to say what version of Oracle you are using. The following query will work in Oracle 9.1 or more.

    What you asked is what I call a Query, fixed-price , and this is a way to do it:

    WITH     player_plus     AS
    (
         SELECT     game_id
         ,     name
         ,     ROW_NUMBER () OVER ( PARTITION BY  game_id
                                   ORDER BY          name
                           )         AS r_num
         FROM    player
    )
    ,     referee_plus     AS
    (
         SELECT     game_id
         ,     name
         ,     ROW_NUMBER () OVER ( PARTITION BY  game_id
                                   ORDER BY          name
                           )         AS r_num
         FROM    referee
    )
    SELECT       g.id
    ,       g.time
    ,       p.name     AS player_name
    ,       r.name     AS referee_name
    FROM             player_plus     p
    FULL OUTER JOIN  referee_plus   r  ON   p.game_id     = r.game_id
                                    AND     p.r_num          = r.r_num
    JOIN           game          g  ON     g.id          = COALESCE (p.game_id, r.game_id)
    ORDER BY  g.id
    ,         COALESCE (p.r_num, r.r_num)
    ;
    

    Output:

    ID         TIME       PLAYER_NAM REFEREE_NA
    ---------- ---------- ---------- ----------
    Game 1     3PM        Player 1   Referee 1
    Game 1     3PM        Player 2   Referee 2
    Game 1     3PM        Player 3
    Game 2     8AM        Player 1   Referee 1
    Game 2     8AM                   Referee 2
    

    I see that you have more arbitrators than players in a game. If such was not the case, then you might make it a bit more efficient using a LEFT OUTER JOIN between p and r, rather than a FULL OUTER JOIN, and you can also use only the columns of p where I use COALESCE.

    Published by: Frank Kulash, March 9, 2012 18:15
    Fixed spelling

  • The query results reel in a file and the number of lines in a different file

    Hello

    I would like to export only the result of my query to a file. I am able to do this with several sql, but I want the number of selected lines in a different file than the output "log".

    For example:

    -------------------------------------
    Select 'TEST' for the DOUBLE;

    TEST

    + 1 row selected. +

    -------------------------------------

    So 'TEST' should be included in the results file and ' 1 selected line"to a different log file.

    Is it possible to achieve this sql * more.

    Thank you for your time

    Rodriguez,

    Hi, Rodriguez,

    Welcome to the forum!

    Here's one way:

    COLUMN     row_cnt_col  NOPRINT     NEW_VALUE row_cnt
    
    --  You may or may not want the following settings.
    --  The 2-file output works with or without them.
    SET     FEEDBACK     OFF
    SET     VERIFY          OFF
    
    SPOOL     dept.txt
    
    SELECT     deptno, dname
    ,     COUNT (*) OVER ()     AS row_cnt_col
    FROM     scott.dept
    ;
    
    SPOOL     OFF
    
    SPOOL     dept.log
    
    SELECT     &row_cnt     AS total_rows_found
    FROM     dual;
    
    SPOOL     OFF
    

    The first SPOOL file, dept.txt, looks like this:

    `   DEPTNO DNAME
    ---------- --------------
            10 ACCOUNTING
            20 RESEARCH
            30 SALES
            40 OPERATIONS
    

    The second SPOOL file, dept.log, looks like this:

    TOTAL_ROWS_FOUND
    ----------------
                   4
    

    Taking your example, only the first query should change:

    SELECT     'TEST'               AS output
    ,     COUNT (*) OVER ()     AS row_cnt_col
    FROM     dual
    ;
    

    The second query and all the stuff set up is exactly the same.

    Published by: Frank Kulash, 27 September 2012 09:38

  • ODM deals Mining Type according to the algorithm

    Running of the ODM 3.0.04 version.
    In the node template, the user can select an algorithm and then select the "Advanced" button to display the "Advanced Configuration" dialog box. The Advanced Settings dialog box allows the user to change the 'Mining Type' (for example numeric or categorical) of an attribute. It is, of course, something you have to do much since ODM often guess the Type mines incorrectly. However, dialog boxes require the user to repeatedly change the Type of Mining for each active algorithm - that is, all four algorithms for a Classification model node. I do not believe that the Type mines is a function of the algorithm. For example, if an attribute is yes/no in a classification algorithm, it is always a yes/no attribute for the following classification algorithm.

    I suggest doing the part of mining Type selection node of data rather than the node class Build Source.

    Is there somewhere other than this forum where we need to incorporate these kinds of suggestions and wishes?

    Hello
    This feature is already scheduled, but it is not well documented or obvious.
    Here are the steps:
    1. the nodes of generation model using a set of heuristics to determine whether to exclude columns from the model of construction process or possibly to change the type of mining (digital to categorical only).
    2. run the node model to build everything first to see what Data Miner provides for the usage parameter data.
    3. to display the parameters of use of data resulting, you go to the advanced settings of the main Editor dialog box dialog box.
    For each model, please uncheck the 'Auto' in the main grid at the top of the dialog box.
    You should now see the details of the setting for use of the data for each model.
    There may be variability as to whether the column is included or not for an algorithm given restrictions of data algorithm type.
    The type of mining will not vary according to the models.
    4. to change a specific setting for more than one model, select all models in the main grid you want change or do ctl - a if you want to select all models.
    Then go to the detail grid and change the settings.
    In this way, you can change the type of mine once, for all models.
    You can also include/exclude columns or turn off the automatic preparation of the data in the same way.
    I will not disable the automatic data preparation, as this could occur in the model build failure if you haven't posted for the preparation of the data required on your own.

    Of course, if you can ignore steps 1 and 2 If you don't want Data Miner to a first cut in these settings.
    For the moment, I made a request to improve the online help for the settings for using data to better explain this behavior.

    Thank you, Mark

  • How to change the number of items in number to Boolean, function VI table

    Hi, I'm working on using the digital output of data acquisition to control the digital input of a DAC, and I used the Number function in Boolean table. VI to convert the number to a Boolean array. The maximum number is 4096, so it must be composed of 12 elements.

    For the description of the VI, it is said that Boolean matrix returns a table of 8, 16, 32 or 64 elements, according to the number of bytes in the whole. Therefore, I change the number of channels in the task to 16, but it still does not work. The suggesitions are greatly appreciated.

    Thank you!

    Possible reasons:

    Scripture cannot be performed because the number of data channels does not match number of channels in the task.

    When writing, provide data for all channels in the task. You can also change the task so that it contains the same number of channels as the written data.

    Number of job channels: 12
    Number of data channels : 32

    Task name: _unnamedTask<1B>

    Once you have the array of Boolean, you can resize using table tools. For example you can use the "new range" with a length of 12 to pad the table of 12 elements of Boolean values (you can also use a subset of table).

  • Generate several plots according to the size of table

    Hi all

    I'm relatively new to LabView and I read several threads that are similar to my problem, but I don't know how to implement it yet.  Basically I have a large table that stores the raw data read from multiple text files.  This large painting size would vary based on the number of text files generated by a data acquisition system.  I would like to draw each line of the table a new field.  Instead of manually wiring, is there an easier way around?

    Thank you

    Lynniz

    Lynniz,

    If you need a separate chart for each parcel then can determine you at least in advance what the maximum number of locations could be and show/hide your graphics programmatically based on data. All the graphs could be in a Subvi that appears separate from your main application window, or you could use a secondary.

    I'm just brainstorming here. There could be a more elegant way to do it, but the graphic masking that already exist is the only thing I can think of right now.

    Eric

  • I want to display the number of success / testing failed in the Testtand of xml report, please help me

    Hi, I want to display the number of success / testing failed in the Testtand of xml report, please help me.

    Later, my requirement is that I should be able to view the number of test / has not passed in the header of the report too.

    I have attached a sequence to give you an idea of how to get the number of results (I don't check it works ), I used 'SequenceFilePostResultListEntry' callback to calculate the number of results.

    and the number of results is passed to the 'ModifyReportHeader' through Globals files, where you can edit the XML file to display in the Repot (follow the link in my previous post).

    Hope this helps

    AshwiN,

Maybe you are looking for