SQL query works too slowly.

Hi all

I have this query that runs very slowly, the prob; em seems to be related to this part of the application

* (select TO_CHAR (MAX (t.PLAYED), 'dd.mm.yyyy hh') from ticket t where t.GAME_PARTICIPANT = p.ID) as LAST_ASP *.

I thought to rewrite that part of the query to a subquery in the where clause somewhere, but don't know how to do and always present is the value of the column in the output after "LAST_ASP".
and do not know if it will be more effective to do so.

Currently, I think that this subquery colum will run to run for each filled condition, and it seems to be the bottleneck in the application, took more than 30 minutes.

The number of rows in this table is about 30 million.


Select p.ID as PARTICIPANTID,
Decode (concat (Sir SALUTATION_CODE, p.lang pp.), '1', 'Dear', '2nd', 'Madame', '1fr', 'Dear Sir', '2fr', 'Ch < E8 > re Madam', '1Il', 'Egregio Signor',')
2 Gentile Signora ',' NA ',' ") as SALUTATION_TEXT,"
pp. NAME,
pp. LASTNAME,
decode (p.VERIFIED, 0, p.EMAIL, 1, p.EMAIL, p.ISL_EMAIL, 2, 3, p.EMAIL, 'NA') than e-mail.
p.LANG, TO_CHAR (pp. BIRTHDAY, 'dd.mm.yyyy') as an ANNIVERSARY,
RAL STREET after street, pa. Number of HOME like NR,
RAL ZIP as PLZ, pa. CITY as ORT,

(select TO_CHAR (MAX (t.PLAYED), 'dd.mm.yyyy hh') from ticket t where t.GAME_PARTICIPANT = p.ID) as LAST_SPA,

Decode (p.verified, 0, "checked", 1, 'Unverified', 2, 'Not migrated', 3, 'rejected', 4, 'changed to another participant', 5,)
6 "Migres MoRo,", "ISL-active user', 'unknown') checked,.
Decode (p.state, 0, 'eligible', 1, 'closed', 2, 'blocked', 'unknown') State
Member p
Join pp PERSINFO left p.ID = pp. PLAYER_ID
PA ADDRESS left join on p.ID = pa. PLAYER_ID
where p.ENABLED = 1
AND STATUS = 1 pp.
AND pa. STATUS = 1
AND TO_CHAR (pp. BIRTHDAY, "mm") = TO_CHAR (ADD_MONTHS (CURRENT_DATE-1), 'mm')


Your help to solve this will be very much appreciated.

Thank you

Hello

1 - the first clue is a great idea. Perhaps the most useful it seems to be the birthday column that seem to be more selective than status.
Is there any clue on the anniversary coumn?
The index might be just that on the anniversary of the column and change the condition like this:

Birthday between to_date(to_char(trunc(trunc(ADD_MONTHS(CURRENT_DATE, -1),'month')),'ddmm')||(to_char(birthday,'yyyy')),'ddmmyyyy')
 and
to_date(to_char(trunc(CURRENT_DATE,'month'),'ddmm')||(to_char(birthday,'yyyy')),'ddmmyyyy')

In this way you create an index that can be used in the future to querys.
Of course, you can add the status column if it is useful.

2 - the second index have lots of columns. Oracle recommends not create indexes on more than three columns. Indexing many columns claim and time with increment when you insert or update the table.
I understand that this index only have access you to the index, and you don't need to access the table, which is faster.
Perhaps accessing an index on the id column is sufficient.

Published by: user648773 on 04/10/2013 10:22: I made a change to the State

Tags: Database

Similar Questions

  • computer acer laptop coat works too slowly

    Acer aspire 9830 works too slowly

    If you mean the clock, it possible that the cmos battery is down. You can get his change.

  • HP G6 works too slowly

    Hi Experts,

    I'm using HP G6 2225TU, Win 7 x 64.

    Whenever I read the 3D mode videos full screen. He plays well but can't return to the small screen. Even using the keys. Alt + Ctrl + delete "esc" or "start" key board.

    Sometimes it works too slowly with 3D movies, just a few times.

    Any suggestion please.

    Hi, @SheikhSahib

    It seems that you cannot quit an application after using full-screen mode, the laptop is running slow for you. I'll try to help.

    What program are you looking at in the video? Have you tried others?

    This can help to speed things up: improvement of system performance without adding memory (Windows 7).

    I hope this can help.
    Thanks for posting on the HP Forums.

  • Microsoft Teredo Tunneling adapter does not work correctly and my pc works too slowly to start and stop.

    Original title: hardware device

    Please help me...

    My Microsoft Teredo Tunneling adapter does not work correctly... I tried to reinstall it but it is impossible to install...

    So what to do so adpter may work correctly...

    And my pc runs too slowly (at startup and shutdown also)

    Help help me soon...

    Thank you...

    Hi Harshhh36,

    Usually, after the computer restarts, the drivers install automatically and it will stop the errors.

    You can also refer to the computer or the network card manufacturer's Web site to download and install the latest version of the drivers for the network card.

    You can also check in the updates of windows updates available for the network adapter driver.

    For more information, see the article:

    Automatically get recommended drivers and updates for your hardware

  • Firefox works too slowly. I have reset it. Update of plugins, but it does not help.

    Firefox worm 25.
    It downloads the pages slowly. I started it without plugins. I've updated all the plugins.
    Sometimes Firefox Watch window 'Script on this page may be busy... ". «The status line showes "transfer data of...» »

    I would like to thank Christophe.
    I did everything you mentioned, but it does not help.
    I found the solution. The steps are:

    1. 1 change of security for adobe flash in the C:\Windows\System32\Macromed\Flash\mms.cfg file add the line ProtectedMode = 0
    2. 2. set in Firefox Subject: config change dom.ipc.plugins.enabled to false and dom.ipc.plugins.java.enabled to true
    3. 3 disable hardware acceleration (advanced - general - settings)

    I guess only the first step and half of second if enough.
    We thank Assistant. My request can be closed.

  • SQL query takes too long to run (1 h 25 min)... pls help how to set up the query.

    Hello

    Could someone please help how to tune the query as its takes a long time to retrieve the results.

    Select

    col1,

    col2,

    col3,

    COL4,

    col5,

    col6,

    col7,

    COL8,

    col9,

    col10,

    Col11,

    col12,

    Sum (volume1),

    Sum (volume2),

    Sum (volume3),

    Sum (volume4),

    Sum (volume5),

    Sum (volume6),

    Sum (volume7),

    Sum (volume8),

    Sum (volume9),

    Sum (volume10),

    Sum (volume11),

    Sum (volume12),

    Sum (volume13),

    Sum (volume14),

    Sum (volume15),

    Sum (volume16),

    Sum (volume17),

    Sum (Volume18),

    Sum (volume19),

    Sum (volume20),

    Sum (rate1),

    Sum (rate2),

    Sum (rate3),

    Sum (rate4),

    Sum (rate5),

    Sum (rate6),

    Sum (rate7),

    Sum (rate8),

    Sum (rate9),

    Sum (rate10),

    Sum (rate11),

    Sum (rate12),

    Sum (rate13),

    Sum (rate14),

    Sum (rate15),

    Sum (rate16),

    Sum (rate17),

    Sum (rate18)

    Sum (rate19),

    Sum (rate20)

    Of

    Table 1 - 13, 25, 99, 400 records

    Table2 - 13, 45, 1000 records

    Table 3 - 4, 50, 000 records

    Table 4 - 1,00,000 records

    table5 - 30 000 records

    where tabl1.col1 = table2.col2,

    Table1.Col1 = table3.col1.

    table2.col2 = table3.col2...

    Group

    Sum (volume1),

    Sum (volume2),

    Sum (volume3),

    Sum (volume4),

    Sum (volume5),

    Sum (volume6),

    Sum (volume7),

    Sum (volume8),

    Sum (volume9),

    Sum (volume10),

    Sum (volume11),

    Sum (volume12),

    Sum (volume13),

    Sum (volume14),

    Sum (volume15),

    Sum (volume16),

    Sum (volume17),

    Sum (Volume18),

    Sum (volume19),

    Sum (volume20),

    Sum (rate1),

    Sum (rate2),

    Sum (rate3),

    Sum (rate4),

    Sum (rate5),

    Sum (rate6),

    Sum (rate7),

    Sum (rate8),

    Sum (rate9),

    Sum (rate10),

    Sum (rate11),

    Sum (rate12),

    Sum (rate13),

    Sum (rate14),

    Sum (rate15),

    Sum (rate16),

    Sum (rate17),

    Sum (rate18)

    Sum (rate19),

    Sum (rate20)

    Thank you

    Prasad.

    > Could someone please help how to tune the query as its takes a long time to retrieve the results.

    The query you posted is obviously fake.

    If you ask to give us a request that you do not post and we cannot see.

    For real?

  • My DVD-RAM works too slowly on Satellite M70

    i've got Matt dvd - ram * one in my satelliteM70 installed in the secondary IDE channel.

    The "DMA if available", it has enable in Device Manager but the player is still in PIO mode then write a DVD disc it takes me 45 minutes. I deleted the second IDE channel and installed again, but it did not help.

    What can I do else?

    Burning speed you use when writing DVD? Do you use DVD-R, DVD - RW, or DVD-RAM media?

    Please do a little bit more information.

    By the way I M70 - 159 and I am very satisfied with the functionality of DVD - RAM drive. For me it is important that created DVDs are usable and I don't like about 5 or 10 minutes of more burning procedure.

  • Qosmio F20: burn DVD works too slowly

    My f20 says he has a dvd burner 8 x speed. but I bought a few brand dvd blank and only at 2 x the speed of combustion. I've tried different brands, but they all burn at 2 x speed. ideas please...

    I have very good experiences with the TDK blank DVD. I use them for my first laptop with DVD writer. I can really recommend it to you.

  • DF820 Digital Photo Frame slideshow works too slowly

    Hi all

    I have a frame of DF820 loaded with about 100 JPEGs on a SanDisk Ultra II SD 2 GB card map.  The size of the picture varies, but most are less than 500 KB.

    The slideshow will run no faster than about 25 sec/pic.  We see the response time even if I use the next or previous buttons.  I have truied to switching between various options, such as Original or Optimal, but nothing seems to affect it.

    For what it's worth, when I turn it on, it takes about 15 seconds to start the hourglass, and another 25 for the first image to load.

    Can someone tell me what could be the problem?

    Kind regards

    The f

    Me again,

    Never mind.  I changed the photos I put about 50 KB, and they load very well.  I'm always surprised how slow, it loads a file, but I guess that's by design.

    -Jeff

  • materialized view ora-00907, although sql query works well

    Hello

    It seems to be a bug with db oracle 10.2.0.1 and his prod. env, I can't apply the patch quickly, can anyone give me a tip

    CREATE THE MV_TEN MATERIALIZED VIEW
    BUILDING THE INDEX REFRESH IMMEDIATE TO COMPLETE ON DEMAND HELP
    AS
    SELECT ten.tcy_refno AS TENANCY_REF,
    Rev.rac_accno AS REV_ACC_NO,
    Rev.rac_last_aba_date AS LAST_ABA_DATE,
    Rev.rac_last_aba_balance AS LAST_ABA_BALANCE,
    AAA.aca_status AS ARREARS_STATUS,
    AAA.aca_ara_code AS ARREARS_ACTION_CODE,
    AAA.aca_effective_date AS EFFECTIVE_DATE,
    AAA.aca_balance AS ACCOUNT_BALANCE,
    ARA.ara_description AS ARREARS_DESCRIPTION,
    NPA.nop_text
    OF REVENUE@remotedb rev.
    Ten TENANCT@remotedb.
    ACCOUNT_ARREARS_ACTIONS@remotedb aaa
    LEFT OUTER JOIN ARREARS_ACTIONS@remotedb ara
    ON aaa.aca_ara_code = ara.ara_code
    LEFT OUTER JOIN NOTEPADS@remotedb IR
    ON aaa.aca_reusable_refno = npa.nop_reusable_refno
    WHERE ten.tcy_refno = rev.rac_tcy_refno
    AND rev.rac_end_date IS NULL
    AND rev.rac_accno = aaa.aca_rac_accno
    AND aaa.aca_status! = "DEL".
    AND npa.nop_current_ind = 'Y ';

    ORA-00907: missing just paraenthesis


    Thank you

    See

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:4226402560732847:P11_QUESTION_ID:6585774577187

  • SDO_RELATE within PL/SQL query with rownum clause runs slowly on 12 c - works great on 10 g

    Hello

    I use the database 12.1.0.2 with a node 2 RAC on Windows.

    I am struck by a really weird performance problem with a particular query.  Bear with me while I try to explain...

    I have a chart with lines 30 sdo_geometry million, in 7 partitions with a local partitioned spatial index divided.  Called BIG_PARTITIONED_TABLE for this example.

    I query the table to search for one line with a geometry that is equal to the geometry of my request.  In this case I use sdo_relate with "mask = equal".  Instantly returns:

    SQL> select id, geometry
      2  from       BIG_PARTITIONED_TABLE o
      3  where      sdo_relate(o.geometry, sdo_geometry(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
      4     SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272)), 'mask=equal') = 'TRUE'
      5  and rownum = 1;
    
            ID
    ----------
    GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    -------------------------------------------------------------------------------
    2.5405E+12
    SDO_GEOMETRY(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272))
    
    Elapsed: 00:00:00.10
    
    

    But if I put the same query in PL/SQL, so it takes 21 seconds:

    SQL> declare
      2     l_id number;
      3     l_geom sdo_geometry;
      4     l_window_geom sdo_geometry;
      5  begin
      6     l_window_geom := sdo_geometry(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
      7             SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272));
      8
      9     select id, geometry
    10     into l_id, l_geom
    11     from    BIG_PARTITIONED_TABLE o
    12     where   sdo_relate(o.geometry, l_window_geom, 'mask=equal') = 'TRUE'
    13     and rownum = 1;
    14
    15  end;
    16  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:21.13
    
    

    If I remove the "rownum = 1", then it returns instantly:

    SQL> declare
      2     l_id number;
      3     l_geom sdo_geometry;
      4     l_window_geom sdo_geometry;
      5  begin
      6     l_window_geom := sdo_geometry(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
      7             SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272));
      8
      9     select id, geometry
    10     into l_id, l_geom
    11     from    BIG_PARTITIONED_TABLE o
    12     where   sdo_relate(o.geometry, l_window_geom, 'mask=equal') = 'TRUE';
    13
    14  end;
    15  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.03
    
    

    If using sdo_equal instead of sdo_relate and keep the "rownum = 1", then it returns instantly.

    SQL> declare
      2     l_id number;
      3     l_geom sdo_geometry;
      4     l_window_geom sdo_geometry;
      5  begin
      6     l_window_geom := sdo_geometry(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
      7             SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272));
      8
      9     select id, geometry
    10     into l_id, l_geom
    11     from    BIG_PARTITIONED_TABLE o
    12     where   sdo_equal(o.geometry, l_window_geom) = 'TRUE'
    13     and rownum = 1;
    14
    15  end;
    16  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.13
    
    

    Here is a comparison of the plans to explain.  First, here's the good thing, that is using the spatial index (BIG_PARTITIONED_TABLE_SPIND):

    select id, GEOMETRY
    FROM
    BIG_PARTITIONED_TABLE O WHERE SDO_EQUAL(O.GEOMETRY, :B1 ) = 'TRUE'
    AND ROWNUM = 1
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.01       0.02          0         39          0           0
    Fetch        1      0.00       0.01          0         31          0           1
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        3      0.01       0.04          0         70          0           1
    
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 263     (recursive depth: 1)
    Number of plan statistics captured: 1
    
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
    ---------- ---------- ----------  ---------------------------------------------------
             1          1          1  COUNT STOPKEY (cr=99 pr=0 pw=0 time=43307 us)
             1          1          1   PARTITION RANGE ALL PARTITION: 1 7 (cr=99 pr=0 pw=0 time=43297 us cost=0 size=66 card=1)
             1          1          1    TABLE ACCESS BY LOCAL INDEX ROWID BIG_PARTITIONED_TABLE PARTITION: 1 7 (cr=99 pr=0 pw=0 time=43280 us cost=0 size=66 card=1)
             1          1          1     DOMAIN INDEX  BIG_PARTITIONED_TABLE_SPIND (cr=98 pr=0 pw=0 time=43250 us)
    
    

    Then the slow that does not use the spatial index.

    select id, GEOMETRY
    FROM
    BIG_PARTITIONED_TABLE O WHERE SDO_RELATE(O.GEOMETRY, :B1 , 'mask=equal') = 'TRUE'
      AND ROWNUM = 1
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.03       0.03          0       1123          0           0
    Fetch        1     24.25      24.25          0     499429          0           1
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        3     24.30      24.29          0     500552          0           1
    
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 263     (recursive depth: 1)
    Number of plan statistics captured: 1
    
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
    ---------- ---------- ----------  ---------------------------------------------------
             1          1          1  COUNT STOPKEY (cr=499532 pr=0 pw=0 time=24289612 us)
             1          1          1   HASH JOIN RIGHT SEMI (cr=499532 pr=0 pw=0 time=24289586 us cost=32 size=144 card=1)
             1          1          1    VIEW  VW_NSO_1 (cr=103 pr=0 pw=0 time=31110 us cost=29 size=98016 card=8168)
             1          1          1     COLLECTION ITERATOR PICKLER FETCH SDO_PQRY (cr=103 pr=0 pw=0 time=31104 us cost=29 size=16336 card=8168)
      16914892   16914892   16914892    PARTITION RANGE ALL PARTITION: 1 7 (cr=499429 pr=0 pw=0 time=28678375 us cost=3 size=6600 card=100)
      16914892   16914892   16914892     TABLE ACCESS FULL BIG_PARTITIONED_TABLE PARTITION: 1 7 (cr=499429 pr=0 pw=0 time=23406547 us cost=3 size=6600 card=100)
    
    

    I tried adding an indication / * + index (o BIG_PARTITIONED_TABLE_SPIND) * / but that did not help.

    I am struck this issue during testing of upgrade 10.2.0.5 to 12.1.0.2.  The query works perfectly on 10g - we note only that this question on 12 c.

    I can't use sdo_equal as the real mask that we want is equal + dommagescausdspar + covers.  I'm just using equal here to simplify the test.

    I use "rownum = 1" because I want to just the first result.  In practice I can rewrite probably is a FOR LOOP, I get out after the first result, but that seems all just awful.

    Any ideas?  If anyone has seen anything like this before?  Its an optimizer delivers really so I'm going to cross post the SQL Forum after a certain time, but thought I would post it here first.

    Thank you

    John

    Hi John,.

    Can you please try the following before your slow queries event?

    "ALTER session set events ' trace 54669 name context forever."

    Thank you

    Ying

  • SQL query simple SQL Developer takes, the wizzard of XE does not work

    Hello everyone

    I wrote this simple query that developer SQL works well, but when I try to run a report based on this sql query, it tells me invalid sql statement. It's true, maybe it's not valid because this IF clause in there... but Developer SQL seems to be very tolerant or includes more...

    I wrote this is because obviously if there is no Boss, ie = 0 then I would get an error when it division by 0, so I put that 0 just for selecting the right


    If count (bosses) > 0
    Select company, zip code.
    sum (Boss/staff)
    assessment
    Group of company, zip code

    Thank you very much

    Alvaro

    Ok. This should work:

    Select company, zip code.
    -case when count (staff)! = 0 here end sum (Boss/staff)
    assessment
    Group of company, zip code

    If this does not work, could you please explain, how your table looks like?

  • SQL query for the region of the tree

    Hello

    I was wondering if someone is able to help me work on a SQL query, to format the data in the table required in a part of the tree... I've never used a tree and I'm fighting to get the right data (if possible).

    The data in the table looks like this:

    data.PNG

    I want to put it in a tree, using level 1 level6 with a final layout that would look like this:

    tree.PNG

    As you can see, the data are formatted in level6 down in the tree, but are filled in the table from level 1. Not all of the columns will be filled, so level2 for anyone 4 (France) is the equivalent of level in the tree like level6 to person 1 (Spain).

    This is Apex 4.2.5

    Oracle 11.2.0.3.0

    Sample data:

    CREATE TABLE employees
       ( employee VARCHAR2(100),
         level1 VARCHAR2(100),
         level2 VARCHAR2(100),
         level3 VARCHAR2(100),
         level4 VARCHAR2(100),
         level5 VARCHAR2(100),
         level6 VARCHAR2(100)   
       );
    
    INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person1','Team One','Recruitment','Human Resources','Fictituous Company','Murcia','Spain');
    INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person2','Team Four','Testing','IT','Big Corporate','Hanover','Germany');
    INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person3','Big Corporate','Hanover','Germany', null, null, null);
    INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person4','Brittany','France', null, null, null, null);
    INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person5','Team Three','Testing','IT','Big Corporate','Hanover','Germany');
    INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person6','Public Relations','Government Agency','Brittany','France', null, null);
    
    

    Added example given.

    Hello

    Apex-user wrote:

    Thanks Frank, this is a good example, I can work with that! Your assumptions are correct.

    A question I came, however, is that I have a data segment that comes across poorly formatted so to speak... where only the lower levels (1-2, etc.) have been filled from the bottom up.

    An example of this data would be:

    1. INSERT INTO employees (employee, level 1, 2, level3, level4, level5, level6) VALUES ('Person7', 'One Team', 'Test', null, null, null, null);

    As you can see that if you rerun the select, the test team is now duplicated, both at the level of the root in the tree as it should.

    You are not sure if the sql can be adjusted to account for this, or if it's too hard?

    It is obviously a question of data and I am trying to solve this separately (extracted data from another system out of my control).

    Thank you!

    Sorry, I'm confused.

    You say that my assumptions were correct.  What includes supported that "If test ' occurs under 'IT' in a row, then the extent of the 'Testing' occurs, it must be under"IT "?  Right after you say that assumptions are correct, you give an example where 'Testing' occurs under 'IT' to a single line, but it is not less 'IT' to another line and where is 'One Team' under 'Testing' in a line, but is 'One Team' under 'Recruitment' in another row.

    When a situation like this occurs, how you cope?  Whenever you have a problem, please post the exact results you want from the given sample data, and an explanation of how you get these results.  If you don't know about what would be the ideal results, or if you are flexible on the exact results, then at least give an example and explain your reasons.

    Maybe you want to change the got_parent of subquery like this:

    WITH unpivoted_data AS

    (

    SELECT *.

    Employees

    UNPIVOT (node_name

    FOR lvl (level1 AS 1

    level2 AS 2

    level3 AS 3

    level4 AS 4

    level5 AS 5

    level6 AS-6

    )

    )

    )

    got_parent AS

    (

    SELECT c.node_name

    MIN (p.node_name) AS a parent

    Of unpivoted_data c

    LEFT OUTER JOIN unpivoted_data p ON p.employee = c.employee

    AND p.lvl = c.lvl + 1

    GROUP BY c.node_name

    )

    SELECT LPAD (' ' ')

    2 * (LEVEL - 1)

    ) || Node_name AS entity

    OF got_parent

    START WITH parent IS NULL

    Parent = node_name PRIOR CONNECTION

    ;

    In this way, if 'Test' is current 'IT' in one line, but not under what in another line, whether under would consider the 'IT' request and not to be a root.  If 'One Team' sudden 'Testing' in a line, but under "Recruitment" in another line, it will be (arbitrarily) consider it under "recruitment".

  • A map of OWB (service line) SQL query

    If I trace a session, run a map OWB (base line), the trace file contains the actual SQL query?

    The problem with me is that when I execute this rank - based OWB card, is throw me an error CursorFetchMapTerminationRTV20007, BUT (most time consuming) when I take on the intermediate SQL insert query, it works very well (and also in a very short time)

    The executing State = COMPLETE

    message = text ORA-06502: PL/SQL: digital or value error: character string buffer too small

    CursorFetchMapTerminationRTV20007 = message text

    N ° of task errors = 0

    N ° task warnings = 2

    N ° errors = 1

    Since this card OWB (truncate insert) is the line in function of where I can't back-end of the generated pl/sql package request OWB so I was wondering if I trace the session, check the trace file, maybe I'll able to see the exact SQL query generated. But I wanted to confirm the same.

    Yes, the real run SQL in session will be in the trace file.

  • Pool pane there problem with long sql query?

    Hello

    I use Jdeveloper 11.1.2.2.0

    In the application I'm developing, there is a long sql query to call (it's a function from a package, which may take a few minutes to run) and I want to display a progress bar for the user.

    The progress bar component is a "progress indicator" and the percentage of achivement is refreshed by a component 'pool' with 1-second interval.

    The two components are connected in a javabean.

    The function with the sql query is the javabean too.

    To run the sql query that is long on background I am calling from a thread, and the pool component get the advancement of the percentage of a pipe filled with the sql function.

    If the function to run is just a long loop of java operations the progress bar works fine, but if I put my long sql query instead, stop listener pool should be performed to stop long, s sql queryo progress are updated only at the end of the long sql query.

    You have any ideas?

    Thank you

    Thanks for your replies. Unfortunately, it was not the solution to my case, sql procedures to block the entire application while ADF awaits them at the end...

    To solve my problem, I finally used a PL SQL Job to call my sql procedure (dbms_job.submit).

    The application is released right after the call and the component of the pool is not more secure!

    Kind regards

    Yann

Maybe you are looking for

  • No alarm beep when you disconnect the power supply a L530 cable?

    With my new ThinkPad L530, I get bored of the beep when the power cable is disconnected. So far, I found no option to turn on the alarm. This feature has been removed completely?

  • Upgrade memory T420s

    @All: I am sure that the issue has been addressed already, so I was wondering if someone could point me to an article or forum topic where I can learn the best way to install a memory in the laptop? In addition, if the memories are of different brand

  • What fix for serscan.sys used?

    I had some difficulties to install and set up my new wireless printer.  The phase of wireless connection requires serscan.sys that is not on my computer running xp family, with a hidden recovery partition I don't know how to access, apart from reinst

  • BlackBerry JDE or Eclipse environment?

    I'm new on this. I developed the rational use and Oracle JDeveloper. Should what environment I use? Thank you

  • Search on Win 7 and Outlook 2010 does not not after installing system updates

    After that I made a few critical Windows updates this weekend. When I try to use the search box in the start menu it shows no answers and when I have the "see more results" ty, it evokes an alert box that says: "Windows cannot access the specified de