Group by order by in same query

Hi,
I am wondering whether it is possible to use group by and order by in same query
For example if i have a table like the one below
Col1 Col2 col3
C 36 2
A 25 5
B 12 8
A 25 6
B 12 9
C 36 1
A 25 7
I need a result like below
A 25 5
A 25 6
A 25 7
B 12 8
B 12 9
C 36 1
C 36 2
can the select statement with group by and order by solve this? How?

Yes you can - though I am not sure that it is what you want. In your example you do not need to group the data, you just need to order by the first column, then the third. If required, you could also throw in the second column;
SQL> with t as  ( 
   select 'C' col1, 36 col2, 2 col3 from dual union all 
   select 'A', 25 ,5 from dual union all 
   select 'B', 12 ,8 from dual union all 
   select 'A', 25 ,6 from dual union all 
   select 'B', 12 ,9 from dual union all 
   select 'C', 36 ,1 from dual union all   
   select 'A', 25 ,7 from dual)  
select col1,col2,col3  
from t
order by col1,col3
COL1       COL2       COL3
A            25          5
A            25          6
A            25          7
B            12          8
B            12          9
C            36          1
C            36          2

Similar Messages

  • Query for Group by & order by

    Hi all,
    I have a table name as angdata77 having attributes like asigno..
    i want to retrieve data from angdata77 by using both group by & order by clauses.. for total count..
    am using the query as
    select asigno,count(*) from angdata77 group by asigno order by asigno;
    Is there any other query for retrieving the data from angdata77
    Thanks in Advance,
    Venkatesh J.

    885756 wrote:
    Ya it's good.. Performance also good while retrieving data...
    I want to know other Possibilities also sir...There will be no better alternative for this, because this is the most simple and straight forward way to get the output you are looking for..
    Go ahead without any confusion... :)

  • Ref cursor is slower than issuing the same query directly

    We are building SQL dynamically in PL/SQL procedure. SQL is complex enough (pivoting, UNIONS, spatial operations, complex underlying view joining many tables). Then we are opening ref cursor output parameter using the following syntax:
    OPEN p_cursor FOR v_sql using p_param1, p_param2;
    Then client code iterates through the rows of the cursor. It takes about a minute. If we run the SQL stored in v_sql variable directly in SQL Plus (replacing bind variables with values of course), we get 4 seconds response time.
    QUESTION: what makes ref cursor being so slow comparing with direct execution of the same query?

    OK, here are the traces. Execution plans look different. I have called SP (which opens ref cursor) first, then applied tkprof on trace file, copied SQL from that file into SQL Plus (before that I have defined bind variables in SQL Plus) and executed it, so I'm 100% sure that in SQL Plus I'm running exactly the same query SP issues for ref cursor.
    1. PL/SQL - ref cursor:
    TKPROF: Release 10.2.0.1.0 - Production on Wed May 16 10:59:30 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Trace file: D:\oracle\product\10.2.0\admin\dae\udump\dae_ora_17004_refcursor.trc
    Sort options: default
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 569 0.12 0.09 0 1707 0 569
    Fetch 0 0.00 0.00 0 0 0 0
    total 571 0.12 0.09 0 1707 0 569
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 75
    declare
    TYPE OutRefCursor IS REF CURSOR;
    TYPE RightClickRec IS RECORD(category_ varchar2(50), subcategory varchar2(50), param_name varchar2(50), param_value varchar2(50));
    rc OutRefCursor;
    rec RightClickRec;
    errno number;
    errmsg varchar2(200);
    begin
    cust_pck_layer.get_right_click_channel_info('7WAN097B_B','TCH',rc, errno, errmsg);
    loop
    fetch rc into rec;
    exit when rc%notfound;
    dbms_output.put_line(rec.category_ || ' ' || rec.subcategory || ' ' || rec.param_name || ' ' || rec.param_value);
    end loop;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.15 0.15 0 0 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.15 0.15 0 0 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 75
    select Category, Sub_Category, Param_Name, Param_Value
    from
    ( ( select distinct 0 as order_c,'TCH Analysis' as Category, NULL as
    Sub_Category,0 as Param_Id, 'Analyzed Sector' as Param_Name, :p_sectorid_1
    as Param_Value, 0 as SORTORDER, 0 as DISTANCE from dual)
    UNION select
    order_c,Category,Sub_Category,Param_Id,Param_Name,stragg(Param_Value) as
    Param_Value,1 as SORTORDER, 0 as DISTANCE from ( select distinct 1 as
    order_c,'TCH Analysis' as Category, NULL as Sub_Category,0 as Param_Id,
    'TCH' as Param_Name, to_char(CHANNEL) as Param_Value, 1 as SORTORDER, 0 as
    DISTANCE from sector_freq_params where SECTOR_ID=:p_SectorId_2 and
    CHAN_TYPE_ID = 2) group by order_c,Category,Sub_Category,Param_Id,
    Param_Name,SORTORDER
    UNION (select r.rr + 1 order_c, 'TCH Analysis' as
    Category, to_char(Sub_Category) as Sub_Category,
    decode(r.rr, 1, 1, 2, 3, 3,
    3, 4, 4, 5, 4) Param_Id,
    decode(r.rr, 1, 'Sector Name', 2, 'Channel
    Number', 3, 'BSIC', 4, 'Relationship', 5, 'Distance to Sector (mi)')
    Param_Name,
    decode(r.rr, 1, SECTOR_ID, 2, Channel_Number, 3, BSIC, 4,
    Relationship, 5, Distance) Param_Value, SORTORDER, DISTANCE from
    (select
    rownum Sub_Category, SECTOR_ID, SORTORDER, Channel_Number, BSIC,
    Relationship, DISTANCE
    from dae_admin.TCH_ANALYSIS_VIEW where
    SELECTED_SECTOR_ID = :p_sectorid_3 and
    SDO_WITHIN_DISTANCE(GEOLOC,
    SELECTED_GEOLOC, 'unit=MILE,distance=25')='TRUE') qry,
    (select 1 rr from
    dual union select 2 from dual union select 3 from dual union select 4 from
    dual union select 5 from dual) r)) order by SORTORDER, DISTANCE, order_c
    asc
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 8513 31.56 33.05 0 1006398 0 8512
    total 8515 31.56 33.05 0 1006398 0 8512
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 75 (recursive depth: 1)
    Rows Row Source Operation
    8512 SORT ORDER BY (cr=1972854 pr=0 pw=0 time=62811214 us)
    8512 VIEW (cr=1972854 pr=0 pw=0 time=62806007 us)
    8512 SORT UNIQUE (cr=1972854 pr=0 pw=0 time=62797492 us)
    8512 UNION-ALL (cr=1972854 pr=0 pw=0 time=2119247 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=1 us)
    1 SORT GROUP BY (cr=2457 pr=0 pw=0 time=16606 us)
    3 VIEW (cr=2457 pr=0 pw=0 time=16040 us)
    3 HASH UNIQUE (cr=2457 pr=0 pw=0 time=16036 us)
    3 PARTITION RANGE ALL PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=3999 us)
    3 TABLE ACCESS FULL SECTOR_FREQ_PARAMS PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=3996 us)
    8510 MERGE JOIN CARTESIAN (cr=1970397 pr=0 pw=0 time=62768739 us)
    5 VIEW (cr=0 pr=0 pw=0 time=54 us)
    5 SORT UNIQUE (cr=0 pr=0 pw=0 time=49 us)
    5 UNION-ALL (cr=0 pr=0 pw=0 time=21 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=2 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=0 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=2 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=1 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=2 us)
    8510 BUFFER SORT (cr=1970397 pr=0 pw=0 time=62760191 us)
    1702 VIEW (cr=1970397 pr=0 pw=0 time=20797110 us)
    1702 COUNT (cr=1970397 pr=0 pw=0 time=20793704 us)
    1702 VIEW TCH_ANALYSIS_VIEW (cr=1970397 pr=0 pw=0 time=20792001 us)
    15588 HASH JOIN (cr=10465 pr=0 pw=0 time=2560803 us)
    15609 MERGE JOIN (cr=4918 pr=0 pw=0 time=1430639 us)
    478112 MERGE JOIN CARTESIAN (cr=2461 pr=0 pw=0 time=659598 us)
    1 PARTITION RANGE ALL PARTITION: 1 2 (cr=4 pr=0 pw=0 time=79 us)
    1 TABLE ACCESS BY LOCAL INDEX ROWID SECTORS PARTITION: 1 2 (cr=4 pr=0 pw=0 time=68 us)
    1 INDEX RANGE SCAN SECTORS_SECTORID_IND PARTITION: 1 2 (cr=3 pr=0 pw=0 time=25 us)(object id 1834180)
    478112 BUFFER SORT (cr=2457 pr=0 pw=0 time=181427 us)
    478112 PARTITION RANGE ALL PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=478158 us)
    478112 TABLE ACCESS FULL SECTOR_FREQ_PARAMS PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=45 us)
    15609 FILTER (cr=2457 pr=0 pw=0 time=1859879 us)
    1434336 SORT JOIN (cr=2457 pr=0 pw=0 time=513880 us)
    3 PARTITION RANGE ALL PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=3966 us)
    3 TABLE ACCESS FULL SECTOR_FREQ_PARAMS PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=3958 us)
    115509 PARTITION RANGE ALL PARTITION: 1 2 (cr=5547 pr=0 pw=0 time=115594 us)
    115509 TABLE ACCESS FULL SECTORS PARTITION: 1 2 (cr=5547 pr=0 pw=0 time=115586 us)
    select count(*)
    from
    mdsys.geodetic_srids where srid = 99900001
    call count cpu elapsed disk query current rows
    Parse 62352 0.53 0.47 0 0 0 0
    Execute 62353 0.78 0.76 0 0 0 0
    Fetch 62352 0.65 0.65 0 187056 0 62352
    total 187057 1.96 1.90 0 187056 0 62352
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 2)
    Rows Row Source Operation
    1 SORT AGGREGATE (cr=3 pr=0 pw=0 time=39 us)
    0 TABLE ACCESS BY INDEX ROWID SDO_CS_SRS (cr=3 pr=0 pw=0 time=24 us)
    1 INDEX UNIQUE SCAN SYS_C003941 (cr=2 pr=0 pw=0 time=14 us)(object id 48833)
    select wktext, srid
    from
    mdsys.cs_srs where srid = 99900001
    call count cpu elapsed disk query current rows
    Parse 31176 0.20 0.20 0 0 0 0
    Execute 31176 0.18 0.26 0 0 0 0
    Fetch 31176 0.20 0.23 0 93528 0 31176
    total 93528 0.59 0.71 0 93528 0 31176
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID SDO_CS_SRS (cr=3 pr=0 pw=0 time=9 us)
    1 INDEX UNIQUE SCAN SYS_C003941 (cr=2 pr=0 pw=0 time=6 us)(object id 48833)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 3 0.00 0.00 0 0 0 0
    Execute 570 0.28 0.25 0 1707 0 570
    Fetch 0 0.00 0.00 0 0 0 0
    total 573 0.28 0.25 0 1707 0 570
    Misses in library cache during parse: 0
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 93529 0.73 0.68 0 0 0 0
    Execute 93530 0.96 1.03 0 0 0 0
    Fetch 102041 32.42 33.94 0 1286982 0 102040
    total 289100 34.12 35.66 0 1286982 0 102040
    Misses in library cache during parse: 0
    93532 user SQL statements in session.
    0 internal SQL statements in session.
    93532 SQL statements in session.
    Trace file: D:\oracle\product\10.2.0\admin\dae\udump\dae_ora_17004_refcursor.trc
    Trace file compatibility: 10.01.00
    Sort options: default
    0 session in tracefile.
    93532 user SQL statements in trace file.
    0 internal SQL statements in trace file.
    93532 SQL statements in trace file.
    5 unique SQL statements in trace file.
    944521 lines in trace file.
    90 elapsed seconds in trace file.
    2. Direct SQL execution:
    TKPROF: Release 10.2.0.1.0 - Production on Wed May 16 11:03:53 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Trace file: D:\oracle\product\10.2.0\admin\dae\udump\dae_ora_17004_sql2.trc
    Sort options: default
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 2 0.00 0.00 0 6 0 2
    Fetch 0 0.00 0.00 0 0 0 0
    total 4 0.00 0.00 0 6 0 2
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 75
    select Category, Sub_Category, Param_Name, Param_Value
    from
    ( ( select distinct 0 as order_c,'TCH Analysis' as Category, NULL as
    Sub_Category,0 as Param_Id, 'Analyzed Sector' as Param_Name, :p_sectorid_1
    as Param_Value, 0 as SORTORDER, 0 as DISTANCE from dual)
    UNION select
    order_c,Category,Sub_Category,Param_Id,Param_Name,stragg(Param_Value) as
    Param_Value,1 as SORTORDER, 0 as DISTANCE from ( select distinct 1 as
    order_c,'TCH Analysis' as Category, NULL as Sub_Category,0 as Param_Id,
    'TCH' as Param_Name, to_char(CHANNEL) as Param_Value, 1 as SORTORDER, 0 as
    DISTANCE from sector_freq_params where SECTOR_ID=:p_SectorId_2 and
    CHAN_TYPE_ID = 2) group by order_c,Category,Sub_Category,Param_Id,
    Param_Name,SORTORDER
    UNION (select r.rr + 1 order_c, 'TCH Analysis' as
    Category, to_char(Sub_Category) as Sub_Category,
    decode(r.rr, 1, 1, 2, 3, 3,
    3, 4, 4, 5, 4) Param_Id,
    decode(r.rr, 1, 'Sector Name', 2, 'Channel
    Number', 3, 'BSIC', 4, 'Relationship', 5, 'Distance to Sector (mi)')
    Param_Name,
    decode(r.rr, 1, SECTOR_ID, 2, Channel_Number, 3, BSIC, 4,
    Relationship, 5, Distance) Param_Value, SORTORDER, DISTANCE from
    (select
    rownum Sub_Category, SECTOR_ID, SORTORDER, Channel_Number, BSIC,
    Relationship, DISTANCE
    from dae_admin.TCH_ANALYSIS_VIEW where
    SELECTED_SECTOR_ID = :p_sectorid_3 and
    SDO_WITHIN_DISTANCE(GEOLOC,
    SELECTED_GEOLOC, 'unit=MILE,distance=25')='TRUE') qry,
    (select 1 rr from
    dual union select 2 from dual union select 3 from dual union select 4 from
    dual union select 5 from dual) r)) order by SORTORDER, DISTANCE, order_c
    asc
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.04 0.03 0 1167 0 0
    Fetch 569 1.20 1.25 0 71026 2 8512
    total 571 1.25 1.29 0 72193 2 8512
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 75
    Rows Row Source Operation
    8512 SORT ORDER BY (cr=86691 pr=0 pw=0 time=1372298 us)
    8512 VIEW (cr=86691 pr=0 pw=0 time=1367047 us)
    8512 SORT UNIQUE (cr=86691 pr=0 pw=0 time=1358534 us)
    8512 UNION-ALL (cr=86691 pr=0 pw=0 time=3191633 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=2 us)
    1 SORT GROUP BY (cr=2457 pr=0 pw=0 time=16109 us)
    3 VIEW (cr=2457 pr=0 pw=0 time=15657 us)
    3 HASH UNIQUE (cr=2457 pr=0 pw=0 time=15651 us)
    3 PARTITION RANGE ALL PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=3875 us)
    3 TABLE ACCESS FULL SECTOR_FREQ_PARAMS PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=3869 us)
    8510 MERGE JOIN CARTESIAN (cr=84234 pr=0 pw=0 time=1166420 us)
    1702 VIEW (cr=84234 pr=0 pw=0 time=1181142 us)
    1702 COUNT (cr=8834 pr=0 pw=0 time=80783 us)
    1702 HASH JOIN (cr=8834 pr=0 pw=0 time=79089 us)
    11349 HASH JOIN (cr=6377 pr=0 pw=0 time=51629 us)
    3 PARTITION RANGE ALL PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=3823 us)
    3 TABLE ACCESS FULL SECTOR_FREQ_PARAMS PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=3817 us)
    3783 NESTED LOOPS (cr=3920 pr=0 pw=0 time=28374 us)
    1 PARTITION RANGE ALL PARTITION: 1 2 (cr=4 pr=0 pw=0 time=91 us)
    1 TABLE ACCESS BY LOCAL INDEX ROWID SECTORS PARTITION: 1 2 (cr=4 pr=0 pw=0 time=78 us)
    1 INDEX RANGE SCAN SECTORS_SECTORID_IND PARTITION: 1 2 (cr=3 pr=0 pw=0 time=39 us)(object id 1834180)
    3783 PARTITION RANGE ALL PARTITION: 1 2 (cr=3916 pr=0 pw=0 time=24510 us)
    3783 TABLE ACCESS BY LOCAL INDEX ROWID SECTORS PARTITION: 1 2 (cr=3916 pr=0 pw=0 time=24504 us)
    3784 DOMAIN INDEX SECTORS_SX (cr=365 pr=0 pw=0 time=13144 us)
    478112 PARTITION RANGE ALL PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=87 us)
    478112 TABLE ACCESS FULL SECTOR_FREQ_PARAMS PARTITION: 1 2 (cr=2457 pr=0 pw=0 time=69 us)
    8510 BUFFER SORT (cr=0 pr=0 pw=0 time=2577 us)
    5 VIEW (cr=0 pr=0 pw=0 time=51 us)
    5 SORT UNIQUE (cr=0 pr=0 pw=0 time=41 us)
    5 UNION-ALL (cr=0 pr=0 pw=0 time=22 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=1 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=0 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=3 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=1 us)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=1 us)
    select text
    from
    view$ where rowid=:1
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 2 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 4 0 2
    total 6 0.00 0.00 0 4 0 2
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY USER ROWID VIEW$ (cr=1 pr=0 pw=0 time=14 us)
    select u.name, o.name, a.interface_version#, o.obj#
    from
    association$ a, user$ u, obj$ o where a.obj# = :1
    and a.property = :2
    and a.statstype# = o.obj# and
    u.user# = o.owner#
    call count cpu elapsed disk query current rows
    Parse 5 0.00 0.00 0 0 0 0
    Execute 6 0.00 0.00 0 0 0 0
    Fetch 5 0.00 0.00 0 33 0 4
    total 16 0.00 0.00 0 33 0 4
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 NESTED LOOPS (cr=8 pr=0 pw=0 time=82 us)
    1 NESTED LOOPS (cr=6 pr=0 pw=0 time=43 us)
    1 TABLE ACCESS BY INDEX ROWID ASSOCIATION$ (cr=2 pr=0 pw=0 time=26 us)
    1 INDEX RANGE SCAN ASSOC1 (cr=1 pr=0 pw=0 time=11 us)(object id 387)
    1 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=4 pr=0 pw=0 time=14 us)
    1 INDEX UNIQUE SCAN I_OBJ1 (cr=3 pr=0 pw=0 time=9 us)(object id 36)
    1 TABLE ACCESS CLUSTER USER$ (cr=2 pr=0 pw=0 time=36 us)
    1 INDEX UNIQUE SCAN I_USER# (cr=1 pr=0 pw=0 time=3 us)(object id 11)
    declare
    cost sys.ODCICost := sys.ODCICost(NULL, NULL, NULL, NULL);
    obj0 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    obj1 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    begin
    :1 := "MDSYS"."SDO_STATISTICS".ODCIStatsFunctionCost(
    sys.ODCIFuncInfo('MDSYS',
    'SDO_3GL',
    'WITHIN_DISTANCE',
    2),
    cost,
    sys.ODCIARGDESCLIST(sys.ODCIARGDESC(2, 'SECTORS', 'DAE_ADMIN', '"GEOLOC"', NULL, NULL, NULL), sys.ODCIARGDESC(2, 'SECTORS', 'DAE_ADMIN', '"GEOLOC"', NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL))
    , obj0, obj1, :5,
    sys.ODCIENV(:6,:7,:8,:9));
    if cost.CPUCost IS NULL then
    :2 := -1.0;
    else
    :2 := cost.CPUCost;
    end if;
    if cost.IOCost IS NULL then
    :3 := -1.0;
    else
    :3 := cost.IOCost;
    end if;
    if cost.NetworkCost IS NULL then
    :4 := -1.0;
    else
    :4 := cost.NetworkCost;
    end if;
    exception
    when others then
    raise;
    end;
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 2 0.00 0.00 0 0 0 2
    Fetch 0 0.00 0.00 0 0 0 0
    total 4 0.00 0.00 0 0 0 2
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 75 (recursive depth: 1)
    declare
    sel number;
    obj0 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    obj1 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    begin
    :1 := "MDSYS"."SDO_STATISTICS".ODCIStatsSelectivity(
    sys.ODCIPREDINFO('MDSYS',
    'SDO_3GL',
    'WITHIN_DISTANCE',
    173),
    sel,
    sys.ODCIARGDESCLIST(sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL), sys.ODCIARGDESC(2, 'SECTORS', 'DAE_ADMIN', '"GEOLOC"', NULL, NULL, NULL), sys.ODCIARGDESC(2, 'SECTORS', 'DAE_ADMIN', '"GEOLOC"', NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL)),
    :3,
    :4
    , obj0, obj1, :5,
    sys.ODCIENV(:6,:7,:8,:9));
    if sel IS NULL then
    :2 := -1.0;
    else
    :2 := sel;
    end if;
    exception
    when others then
    raise;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 0 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 75 (recursive depth: 1)
    select a.default_cpu_cost, a.default_io_cost
    from
    association$ a where a.obj# = :1
    and a.property = :2
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 1 0 0
    total 3 0.00 0.00 0 1 0 0
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 TABLE ACCESS BY INDEX ROWID ASSOCIATION$ (cr=1 pr=0 pw=0 time=7 us)
    0 INDEX RANGE SCAN ASSOC1 (cr=1 pr=0 pw=0 time=6 us)(object id 387)
    declare
    cost sys.ODCICost := sys.ODCICost(NULL, NULL, NULL, NULL);
    obj1 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    obj2 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    begin
    :1 := "MDSYS"."SDO_STATISTICS".ODCIStatsIndexCost(
    sys.ODCIINDEXINFO('DAE_ADMIN',
    'SECTORS_SX',
    sys.ODCICOLINFOLIST(sys.ODCICOLINFO('DAE_ADMIN', 'SECTORS', '"GEOLOC"', 'SDO_GEOMETRY', 'MDSYS', NULL)),
    NULL,
    3,
    0),
    1.00000000,
    cost,
    sys.ODCIQUERYINFO(2,
    NULL),
    sys.ODCIPREDINFO('MDSYS',
    'SDO_WITHIN_DISTANCE',
    NULL,
    141),
    sys.ODCIARGDESCLIST(sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL), sys.ODCIARGDESC(2, 'SECTORS', 'DAE_ADMIN', '"GEOLOC"', NULL, NULL, NULL), sys.ODCIARGDESC(2, 'SECTORS', 'DAE_ADMIN', '"GEOLOC"', NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL)),
    :6,
    :7
    , obj2, :8,
    sys.ODCIENV(:9,:10,:11,:12));
    if cost.CPUCost IS NULL then
    :2 := -1.0;
    else
    :2 := cost.CPUCost;
    end if;
    if cost.IOCost IS NULL then
    :3 := -1.0;
    else
    :3 := cost.IOCost;
    end if;
    if cost.NetworkCost IS NULL then
    :4 := -1.0;
    else
    :4 := cost.NetworkCost;
    end if;
    :5 := cost.IndexCostInfo;
    exception
    when others then
    raise;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 0 0 0
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 75 (recursive depth: 1)
    SELECT diminfo, nvl(srid,-1)
    FROM
    ALL_SDO_GEOM_METADATA WHERE OWNER = 'DAE_ADMIN' AND TABLE_NAME =
    NLS_UPPER('SECTORS') AND '"'||COLUMN_NAME||'"' = '"GEOLOC"'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 44 0 1
    total 3 0.00 0.00 0 44 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID SDO_GEOM_METADATA_TABLE (cr=44 pr=0 pw=0 time=1743 us)
    1 INDEX RANGE SCAN SDO_GEOM_IDX (cr=43 pr=0 pw=0 time=1732 us)(object id 45847)
    1 UNION-ALL (cr=42 pr=0 pw=0 time=1702 us)
    1 FILTER (cr=42 pr=0 pw=0 time=1697 us)
    1 HASH JOIN (cr=42 pr=0 pw=0 time=1694 us)
    1 MERGE JOIN CARTESIAN (cr=42 pr=0 pw=0 time=955 us)
    1 NESTED LOOPS (cr=42 pr=0 pw=0 time=462 us)
    1 NESTED LOOPS OUTER (cr=38 pr=0 pw=0 time=446 us)
    1 HASH JOIN OUTER (cr=35 pr=0 pw=0 time=434 us)
    1 NESTED LOOPS OUTER (cr=17 pr=0 pw=0 time=111 us)
    1 NESTED LOOPS OUTER (cr=17 pr=0 pw=0 time=107 us)
    1 NESTED LOOPS (cr=17 pr=0 pw=0 time=100 us)
    3 NESTED LOOPS (cr=9 pr=0 pw=0 time=61 us)
    1 TABLE ACCESS BY INDEX ROWID USER$ (cr=2 pr=0 pw=0 time=16 us)
    1 INDEX UNIQUE SCAN I_USER1 (cr=1 pr=0 pw=0 time=6 us)(object id 44)
    3 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=7 pr=0 pw=0 time=44 us)
    3 INDEX RANGE SCAN I_OBJ2 (cr=4 pr=0 pw=0 time=16 us)(object id 37)
    1 TABLE ACCESS CLUSTER TAB$ (cr=8 pr=0 pw=0 time=36 us)
    1 INDEX UNIQUE SCAN I_OBJ# (cr=5 pr=0 pw=0 time=18 us)(object id 3)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=3 us)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=2 us)(object id 36)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=1 us)(object id 36)
    75 TABLE ACCESS FULL USER$ (cr=18 pr=0 pw=0 time=35 us)
    0 TABLE ACCESS CLUSTER SEG$ (cr=3 pr=0 pw=0 time=10 us)
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (cr=3 pr=0 pw=0 time=9 us)(object id 9)
    1 TABLE ACCESS CLUSTER TS$ (cr=4 pr=0 pw=0 time=13 us)
    1 INDEX UNIQUE SCAN I_TS# (cr=2 pr=0 pw=0 time=6 us)(object id 7)
    1 BUFFER SORT (cr=0 pr=0 pw=0 time=489 us)
    1 FIXED TABLE FULL X$KSPPI (cr=0 pr=0 pw=0 time=470 us)
    1120 FIXED TABLE FULL X$KSPPCV (cr=0 pr=0 pw=0 time=1125 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us)(object id 103)
    0 FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us)
    0 FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us)
    0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 MERGE JOIN CARTESIAN (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER1 (cr=0 pr=0 pw=0 time=0 us)(object id 44)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJ2 (cr=0 pr=0 pw=0 time=0 us)(object id 37)
    0 TABLE ACCESS CLUSTER TAB$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ# (cr=0 pr=0 pw=0 time=0 us)(object id 3)
    0 TABLE ACCESS CLUSTER COL$ (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID COLTYPE$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_COLTYPE2 (cr=0 pr=0 pw=0 time=0 us)(object id 170)
    0 TABLE ACCESS CLUSTER TS$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_TS# (cr=0 pr=0 pw=0 time=0 us)(object id 7)
    0 TABLE ACCESS CLUSTER SEG$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (cr=0 pr=0 pw=0 time=0 us)(object id 9)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJ3 (cr=0 pr=0 pw=0 time=0 us)(object id 38)
    0 TABLE ACCESS CLUSTER USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER# (cr=0 pr=0 pw=0 time=0 us)(object id 11)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
    0 TABLE ACCESS CLUSTER USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER# (cr=0 pr=0 pw=0 time=0 us)(object id 11)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
    0 TABLE ACCESS CLUSTER USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER# (cr=0 pr=0 pw=0 time=0 us)(object id 11)
    0 BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
    0 FIXED TABLE FULL X$KSPPI (cr=0 pr=0 pw=0 time=0 us)
    0 FIXED TABLE FULL X$KSPPCV (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us)(object id 103)
    0 FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us)
    0 FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us)
    0 VIEW ALL_SYNONYMS (cr=0 pr=0 pw=0 time=0 us)
    0 SORT UNIQUE (cr=0 pr=0 pw=0 time=0 us)
    0 UNION-ALL (cr=0 pr=0 pw=0 time=0 us)
    0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER1 (cr=0 pr=0 pw=0 time=0 us)(object id 44)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJ2 (cr=0 pr=0 pw=0 time=0 us)(object id 37)
    0 TABLE ACCESS BY INDEX ROWID SYN$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_SYN1 (cr=0 pr=0 pw=0 time=0 us)(object id 101)
    0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER1 (cr=0 pr=0 pw=0 time=0 us)(object id 44)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJ2 (cr=0 pr=0 pw=0 time=0 us)(object id 37)
    0 INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us)(object id 103)
    0 FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us)
    0 FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER1 (cr=0 pr=0 pw=0 time=0 us)(object id 44)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJ2 (cr=0 pr=0 pw=0 time=0 us)(object id 37)
    0 VIEW ALLSYNONYMS_TREE (cr=0 pr=0 pw=0 time=0 us)
    0 CONNECT BY WITH FILTERING (cr=0 pr=0 pw=0 time=0 us)
    0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 COUNT (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL SYN$ (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
    0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID SYN$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_SYN1 (cr=0 pr=0 pw=0 time=0 us)(object id 101)
    0 TABLE ACCESS BY INDEX ROWID USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER1 (cr=0 pr=0 pw=0 time=0 us)(object id 44)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJ2 (cr=0 pr=0 pw=0 time=0 us)(object id 37)
    0 INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us)(object id 103)
    0 FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 CONNECT BY PUMP (cr=0 pr=0 pw=0 time=0 us)
    0 COUNT (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL SYN$ (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
    0 COUNT (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL SYN$ (cr=0 pr=0 pw=0 time=0 us)
    0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS FULL OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
    0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID SYN$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_SYN1 (cr=0 pr=0 pw=0 time=0 us)(object id 101)
    0 TABLE ACCESS BY INDEX ROWID USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER1 (cr=0 pr=0 pw=0 time=0 us)(object id 44)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJ2 (cr=0 pr=0 pw=0 time=0 us)(object id 37)
    0 INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us)(object id 103)
    0 FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID SYN$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_SYN1 (cr=0 pr=0 pw=0 time=0 us)(object id 101)
    0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER1 (cr=0 pr=0 pw=0 time=0 us)(object id 44)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJ2 (cr=0 pr=0 pw=0 time=0 us)(object id 37)
    0 INDEX UNIQUE SCAN I_TYPED_VIEW1 (cr=0 pr=0 pw=0 time=0 us)(object id 100)
    0 INDEX UNIQUE SCAN I_VIEW1 (cr=0 pr=0 pw=0 time=0 us)(object id 99)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us)(object id 103)
    0 FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us)
    0 FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us)
    SELECT nvl(sdo_level,0), nvl(sdo_numtiles,0), nvl(sdo_maxlevel, 0),
    nvl(sdo_index_table, 'DEFAULT'), sdo_index_primary, sdo_index_type,
    nvl(sdo_rtree_height, 0), nvl(sdo_rtree_num_nodes, 0),
    nvl(sdo_rtree_dimensionality, 0), nvl(sdo_rtree_fanout, 0),
    nvl(sdo_rtree_root, 'EMPTY'), nvl(sdo_rtree_seq_name, 'DEFAULT'),
    sdo_index_partition, nvl(sdo_partitioned, 0), nvl(sdo_layer_gtype,
    'DEFAULT'), nvl(sdo_index_dims, 0), nvl(sdo_rtree_pctfree, 10),
    nvl(sdo_rtree_quality, 1), nvl(sdo_index_version, 0), nvl(sdo_tablespace,
    'DEFAULT'), nvl(sdo_index_geodetic, 'FALSE'), sdo_index_status,
    nvl(sdo_nl_index_table, 'NULL'), nvl(sdo_dml_batch_size, 1),
    nvl(sdo_rtree_ent_xpnd, 0.0)
    FROM
    all_sdo_index_metadata WHERE sdo_index_owner = 'DAE_ADMIN' and
    sdo_index_name = 'SECTORS_SX' and sdo_index_partition = UPPER(:ptname)
    ORDER BY SDO_INDEX_PRIMARY
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 43 0 1
    total 3 0.00 0.00 0 43 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 1)
    select count(*)
    from
    mdsys.geodetic_srids where srid = 99900001
    call count cpu elapsed disk query current rows
    Parse 3405 0.01 0.01 0 0 0 0
    Execute 3405 0.04 0.03 0 0 0 0
    Fetch 3405 0.07 0.03 0 10215 0 3405
    total 10215 0.14 0.08 0 10215 0 3405
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 1)
    Rows Row Source Operation
    1 SORT AGGREGATE (cr=3 pr=0 pw=0 time=26 us)
    0 TABLE ACCESS BY INDEX ROWID SDO_CS_SRS (cr=3 pr=0 pw=0 time=17 us)
    1 INDEX UNIQUE SCAN SYS_C003941 (cr=2 pr=0 pw=0 time=9 us)(object id 48833)
    select wktext, srid
    from
    mdsys.cs_srs where srid = 99900001
    call count cpu elapsed disk query current rows
    Parse 1704 0.00 0.01 0 0 0 0
    Execute 1704 0.00 0.01 0 0 0 0
    Fetch 1704 0.03 0.01 0 5112 0 1704
    total 5112 0.03 0.03 0 5112 0 1704
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID SDO_CS_SRS (cr=3 pr=0 pw=0 time=8 us)
    1 INDEX UNIQUE SCAN SYS_C003941 (cr=2 pr=0 pw=0 time=5 us)(object id 48833)
    SELECT partition_count
    FROM
    all_part_indexes WHERE owner='DAE_ADMIN' and index_name='SECTORS_SX'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 18 0 1
    total 3 0.00 0.00 0 18 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 1)
    Rows Row Source Operation
    1 FILTER (cr=18 pr=0 pw=0 time=70 us)
    1 NESTED LOOPS (cr=18 pr=0 pw=0 time=67 us)
    1 NESTED LOOPS OUTER (cr=15 pr=0 pw=0 time=59 us)
    1 NESTED LOOPS (cr=13 pr=0 pw=0 time=52 us)
    1 NESTED LOOPS (cr=10 pr=0 pw=0 time=42 us)
    1 NESTED LOOPS (cr=7 pr=0 pw=0 time=29 us)
    1 TABLE ACCESS BY INDEX ROWID USER$ (cr=2 pr=0 pw=0 time=8 us)
    1 INDEX UNIQUE SCAN I_USER1 (cr=1 pr=0 pw=0 time=4 us)(object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=5 pr=0 pw=0 time=20 us)
    1 INDEX RANGE SCAN I_OBJ2 (cr=4 pr=0 pw=0 time=14 us)(object id 37)
    1 TABLE ACCESS BY INDEX ROWID PARTOBJ$ (cr=3 pr=0 pw=0 time=10 us)
    1 INDEX UNIQUE SCAN I_PARTOBJ$ (cr=2 pr=0 pw=0 time=6 us)(object id 263)
    1 TABLE ACCESS BY INDEX ROWID IND$ (cr=3 pr=0 pw=0 time=8 us)
    1 INDEX UNIQUE SCAN I_IND1 (cr=2 pr=0 pw=0 time=5 us)(object id 39)
    0 TABLE ACCESS CLUSTER TS$ (cr=2 pr=0 pw=0 time=6 us)
    0 INDEX UNIQUE SCAN I_TS# (cr=2 pr=0 pw=0 time=4 us)(object id 7)
    1 INDEX UNIQUE SCAN I_OBJ1 (cr=3 pr=0 pw=0 time=7 us)(object id 36)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us)(object id 103)
    0 FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us)
    0 FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us)
    SELECT nvl(sdo_index_partition, 'DEFAULT'), nvl(sdo_index_table, 'DEFAULT'),
    nvl(sdo_rtree_height,0), nvl(sdo_rtree_num_nodes,0),
    nvl(sdo_rtree_root,'EMPTY'), nvl(sdo_layer_gtype, 'DEFAULT'),
    nvl(sdo_index_status, 'VALID'), sdo_root_mbr
    FROM
    all_sdo_index_metadata WHERE sdo_index_owner='DAE_ADMIN' and sdo_index_name=
    'SECTORS_SX' and sdo_index_partition is not null ORDER BY
    sdo_index_partition
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 45 0 2
    total 4 0.00 0.00 0 45 0 2
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 1)
    Rows Row Source Operation
    2 TABLE ACCESS BY INDEX ROWID SDO_INDEX_METADATA_TABLE (cr=45 pr=0 pw=0 time=155 us)
    2 INDEX RANGE SCAN SDO_IDX_MDATA_IDX (cr=43 pr=0 pw=0 time=142 us)(object id 48798)
    1 FILTER (cr=40 pr=0 pw=0 time=121 us)
    1 NESTED LOOPS OUTER (cr=40 pr=0 pw=0 time=118 us)
    1 NESTED LOOPS OUTER (cr=38 pr=0 pw=0 time=111 us)
    1 NESTED LOOPS OUTER (cr=34 pr=0 pw=0 time=100 us)
    1 NESTED LOOPS (cr=31 pr=0 pw=0 time=92 us)
    1 NESTED LOOPS (cr=22 pr=0 pw=0 time=78 us)
    1 NESTED LOOPS OUTER (cr=18 pr=0 pw=0 time=66 us)
    1 NESTED LOOPS (cr=15 pr=0 pw=0 time=56 us)
    3 NESTED LOOPS (cr=9 pr=0 pw=0 time=34 us)
    1 TABLE ACCESS BY INDEX ROWID USER$ (cr=2 pr=0 pw=0 time=6 us)
    1 INDEX UNIQUE SCAN I_USER1 (cr=1 pr=0 pw=0 time=4 us)(object id 44)
    3 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=7 pr=0 pw=0 time=24 us)
    3 INDEX RANGE SCAN I_OBJ2 (cr=4 pr=0 pw=0 time=9 us)(object id 37)
    1 TABLE ACCESS BY INDEX ROWID IND$ (cr=6 pr=0 pw=0 time=20 us)
    1 INDEX UNIQUE SCAN I_IND1 (cr=5 pr=0 pw=0 time=12 us)(object id 39)
    1 TABLE ACCESS CLUSTER TS$ (cr=3 pr=0 pw=0 time=9 us)
    1 INDEX UNIQUE SCAN I_TS# (cr=2 pr=0 pw=0 time=4 us)(object id 7)
    1 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=4 pr=0 pw=0 time=10 us)
    1 INDEX UNIQUE SCAN I_OBJ1 (cr=3 pr=0 pw=0 time=6 us)(object id 36)
    1 TABLE ACCESS CLUSTER USER$ (cr=9 pr=0 pw=0 time=13 us)
    1 INDEX UNIQUE SCAN I_USER# (cr=1 pr=0 pw=0 time=3 us)(object id 11)
    0 TABLE ACCESS CLUSTER SEG$ (cr=3 pr=0 pw=0 time=7 us)
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (cr=3 pr=0 pw=0 time=6 us)(object id 9)
    1 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=4 pr=0 pw=0 time=7 us)
    1 INDEX UNIQUE SCAN I_OBJ1 (cr=3 pr=0 pw=0 time=4 us)(object id 36)
    1 TABLE ACCESS CLUSTER USER$ (cr=2 pr=0 pw=0 time=6 us)
    1 INDEX UNIQUE SCAN I_USER# (cr=1 pr=0 pw=0 time=2 us)(object id 11)
    0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us)(object id 103)
    0 FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us)
    0 FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us)
    SELECT info
    from
    DAE_ADMIN.MDRT_1BFCC9$ where rowid = :rid
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 1 0 1
    total 3 0.00 0.00 0 1 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY USER ROWID MDRT_1BFCC9$ (cr=1 pr=0 pw=0 time=14 us)
    SELECT info
    from
    DAE_ADMIN.MDRT_1C72A2$ where rowid = :rid
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 187 0.00 0.00 0 0 0 0
    Fetch 187 0.01 0.00 0 187 0 187
    total 376 0.01 0.00 0 187 0 187
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62 (recursive depth: 1)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 3 0.00 0.00 0 0 0 0
    Execute 3 0.04 0.03 0 1173 0 2
    Fetch 569 1.20 1.25 0 71026 2 8512
    total 575 1.25 1.29 0 72199 2 8514
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 5128 0.01 0.03 0 0 0 0
    Execute 5314 0.04 0.05 0 0 0 3
    Fetch 5310 0.12 0.04 0 15703 0 5308
    total 15752 0.18 0.12 0 15703 0 5311
    Misses in library cache during parse: 0
    5123 user SQL statements in session.
    8 internal SQL statements in session.
    5131 SQL statements in session.
    Trace file: D:\oracle\product\10.2.0\admin\dae\udump\dae_ora_17004_sql2.trc
    Trace file compatibility: 10.01.00
    Sort options: default
    0 session in tracefile.
    5123 user SQL statements in trace file.
    8 internal SQL statements in trace file.
    5131 SQL statements in trace file.
    16 unique SQL statements in trace file.
    50973 lines in trace file.
    21 elapsed seconds in trace file.

  • Issue in creation of group in oim database through sql query.

    hi guys,
    i am trying to create a group in oim database through sql query:
    insert into ugp(ugp_key,ugp_name,ugp_create,ugp_update,ugp_createby,ugp_updateby,)values(786,'dbrole','09-jul-12','09-jul-12',1,1);
    it is inserting the group in ugp table but it is not showing in admin console.
    After that i also tried with this query:
    insert into gpp(ugp_key,gpp_ugp_key,gpp_write,gpp_delete,gpp_create,gpp_createby,gpp_update,gpp_updateby)values(786,1,1,1,'09-jul-12',1,'09-jul-12',1);
    After that i tried with this query.but still no use.
    and i also tried to assign a user to the group through query:
    insert into usg(ugp_key,usr_key,usg_priority,usg_create,usg_update,usg_createby,usg_updateby)values(4,81,1,'09-jul-12','09-jul-12',1,1);
    But still the same problem.it is inserting in db.but not listing in admin console.
    thanks,
    hanuman.

    Hanuman Thota wrote:
    hi vladimir,
    i didn't find this 'ugp_seq'.is this a table or column?where is it?
    It is a sequence.
    See here for details on oracle sequences:
    http://www.techonthenet.com/oracle/sequences.php
    Most of the OIM database schema is created with the following script, located in the RCU distribution:
    $RCU_HOME/rcu/integration/oim/sql/xell.sql
    there you'll find plenty of sequence creation directives like:
    create sequence UGP_SEQ
    increment by 1
    start with 1
    cache 20
    to create a sequence, and
    INSERT INTO UGP (UGP_KEY, UGP_NAME, UGP_UPDATEBY, UGP_UPDATE, UGP_CREATEBY, UGP_CREATE,UGP_ROWVER, UGP_DATA_LEVEL, UGP_ROLE_CATEGORY_KEY, UGP_ROLE_OWNER_KEY, UGP_DISPLAY_NAME, UGP_ROLENAME, UGP_DESCRIPTION, UGP_NAMESPACE)
    VALUES (ugp_seq.nextval,'SYSTEM ADMINISTRATORS', sysadmUsrKey , SYSDATE,sysadmUsrKey , SYSDATE, hextoraw('0000000000000000'), 1, roleCategoryKey, sysadmUsrKey, 'SYSTEM ADMINISTRATORS', 'SYSTEM ADMINISTRATORS', 'System Administrator role for OIM', 'Default');
    as a sequence usage example.
    Regards,
    Vladimir

  • Best practice for a same query against 2 different tables

    Hello all,
    I want to extract info about tablespaces storage, both permanent and temporary. For that I use 2 different cursors that do exactly the same query but against a different table (dba_data_files and dba_temp_files).
    CURSOR permanentTBSStorageInfo (tablespaceName VARCHAR2) IS
    SELECT file_name, bytes, autoextensible, maxbytes, increment_by
    FROM dba_data_files
    WHERE tablespace_name = tablespaceName;
    CURSOR temporaryTBSStorageInfo (tablespaceName VARCHAR2) IS
    SELECT file_name, bytes, autoextensible, maxbytes, increment_by
    FROM dba_temp_files
    WHERE tablespace_name = tablespaceName;
    First I'm bothered that I have to use 2 cursors to execute the same query against 2 different tables. Is there no another way around?
    Then I fetch the results of this cursors in 2 different loops because I didn't find a way to dynamically call the cursors. I am looking for best practice here, knowing that I will do the same parsing against the results of the 2 cursors.
    Thank you,

    Hi
    Check whether the below query is helpful or not
    select      fs.tablespace_name "Tablespace",
         fs.tempspace "Temp MB",
         df.totalspace "Total MB"
         from
         (select
         tablespace_name,
         round(sum(bytes) / 1048576) TotalSpace
         from
         dba_data_files
         group by
         tablespace_name
         ) df,
         (select
         tablespace_name,
         round(sum(bytes) / 1048576) tempSpace
         from
         dba_temp_files
         group by
         tablespace_name
         ) fs
         where
         df.tablespace_name = fs.tablespace_name;
    Thanks

  • Different view of the same query between users

    Hi at all,
    I strongly hope you can help me.
    The problem that i have is that:
    I have a different view of a query inserted in a workbook respect the view of the same query that have other users.
    In particular I watch in my query 4 fixed characteristic of the query ( Cost center, order type , controlling area, fiscal variant ), below the free characteristic block  and before data table.
    Instead other user watch only 3 fixed characteristics ( Cost center, order type , controlling area ).
    This is a problem because in the workbook there is a macro that reads the data from a fixed raw. So that this macro doesn't' t work in my workbook.
    I would specify that the workbooks is called from rules and not from fevorites.
    Thank you very much for your attention!
    Bye
    Fabio

    Hi Erwan,
    i have the SAPGUI version 3500.8.044 and the item you describes :
    Bex menu ( Business explorer -> Change Query -> Change variable values )
    let me to change the values of input variables.
    The new layout query, after the input of the new values, has the same rows of the fixed query value ( fyscal variant too).
    Thank you for your answer..
    bye
    Fabio

  • Merge of planned orders from the same product

    Hi Experts,
    We have some lines where we process materials with different properties so setup time/costs between ones and anothers are very important.
    If we run the PPDS Optimizer or scheduling based on setup groups for a period of 2 weeks then depending on the demands we may get 2 or 3 orders of the same material followed. Is there a possibility that once we have the short-term plan and we have this situation we run a heuristic that merge orders from the same material into one order? Capacity Driven heuristic does not fulfill our requirements.
    Ex:
    Order 1 = 10000 PC
    Order 2 = 20000 PC
    Order 3 = 5000 PC
    They are followed in the resource so we would like to have one of 35000 PC.
    Right now, we are using a simulation so looking at the total amount of the followed orders then we can get an idea of which should be the minimum lot size to be used .   They can also modify the total quantity of the first order with the sum of the others but none of these 2 options makes the customer totally happy.
    Any suggestions?
    Regards
    CTF

    After PPDS Optimizer .
    Get the list of all FG PPDS orders into an internal table.
    Use     BAPI_PRDSRVAPS_GETLIST2
               BAPI_MOSRVAPS_GETLIST2
    Consolidate the orders which are in scheduled status for each product, resource and PPM.
    Sum the quantities.Create the Orders and delete the old orders.
    Use BAPI_MOSRVAPS_DELEMULTI (For deleting the Orders)
    Use BAPI_MOSRVAPS_SAVEMULTI3( For creating a new Order)
    Thanks,
    nandha

  • How to share the same QUERY among report, chart on the same page? and more

    Dear HTMLDB experts,
    I am absolute rookie to this tool, so I have some questions need you all's help.
    (1)
    When I build a page with a spread sheet and a chart on the same page, they all use the same query to get the data. However, I have to type in the SQL twice in spread sheet(report region) and chart's attribute sections. It seems so dumb, does it really run the same query twice, is there a way to share the same query?
    i.e. SELECT name, timestamp, value FROM foo WHERE name = :P1_NAME? (by the way, is :P1_NAME case sensitive?)
    (2)
    In the same chart, if I have two series from two columns of the same table, I have to write 2 queries, one
    select null, timestamp, value1 from same_table
    and
    select null, timestamp, value2 from same_table
    Is it possible to use one query: select timestamp, value1, value2 from same_table and define the series on two value columns of this single query? It's really no point to run two queris.
    (3)
    In a chart, when the query has ORDER by clause, it seems the chart is not showing up.
    So instead of using the query below
    SELECT null, to_char(ts,'mmdd') ts, value
    FROM same_table
    WHERE ts >= TRUNC(SYSDATE) - :P2_DAYSAGO - 1
    AND name = :P1_NAME
    ORDER BY ts
    I have to use a walkaround query
    SELECT null, ts, used
    FROM
    SELECT null, to_char(ts,'mmdd') ts, value
    FROM same_table
    WHERE ts >= TRUNC(SYSDATE) - :P2_DAYSAGO - 1
    AND name = :P1_NAME
    ORDER BY ts
    Further more, it seems :P1_NAME in the same subquery is not working for the chart, i get xml parsing errors in SVGviewer, however the same query works for the spread sheet area, I am really puzzeled. Not sure whether it's dumb tool or dumb me :-)
    Appreciate your help!
    Jianhui

    <quote>
    Further more, it seems :P1_NAME in the same subquery is not working for the chart, i get xml parsing errors in SVGviewer, however the same query works for the spread sheet area, I am really puzzeled. Not sure whether it's dumb tool or dumb me :-)
    </quote>
    For this particular issue, I found out that neither is the tool dumb nor is me. It's SVGViewer messed up with the firefox browser, after I rebooted the computer this morning, problem is gone. I didnt reboot after I copied SVGViewer dll and zip file to firefox plugin directory yesterday. Never had that pain with IE and Netscape, oh well :-). So please ignore this section, however other questions are still unsolved puzzles for me. Thank you all if you can share some light on those questions.

  • Different results for the same query and same data !  (oracle 9i)

    Hi,
    This is a mystery for me. I've got on my database exactly the same data that my customer (exported schema). We both launch the same query (generated by the software that we sold him). This query has a criteria IN (SELECT MAX()...) to get only data from the last year.
    The query gives 477 rows on my computer (correct answer), but no row on his! We have the same data! The only difference is the Oracle release : 9.2.0.6.0 for him, 9.2.0.1.0 for me.
    If he executes the subquery alone, it gives the expected result.
    If he replaces the MAX() in the subquery by the returned value (year 2016), he gets his 477 rows.
    I've rewritten the query with a NOT EXISTS, and now all is fine. (Less efficient but it works).
    I have no rational explication. Did I miss something ?
    Thanks for any answer.
    This is the query:
    SELECT ...
    FROM
    CRA, GRA, ...
    WHERE
    /* subselect */
    (CRA.COLLCOD, CRA.CRANEXE, CRA.CRANCODBUD, CRA.GRANNUM, CRA.CRANCOD1, CRA.CRANCOD2, CRA.CRANCOD3, CRA.CRANCOD4)
    IN (
    SELECT b.COLLCOD, MAX(cranexe), b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    FROM CRA b
    GROUP BY b.COLLCOD, b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    AND... /* other filters and joins */

    v9.2.0.1 was full of bugs. a lot of these bugs had to do with "incorrect results", typically associated with old stats or complex queries (certain types of subqueries were very likely to give wrong resutls, due to the way they were rewritten by the optimizer).
    apply the 9.2.0.6 patch set

  • How Do I Sort a Group of Photos on the Same Page with the same Keyword Tag?

    I want to group similar photos on the same page with the same keyword tag.  I have tried dragging and dropping without any success.  Can anyone help?

      Create an album, then search using a keyword. Select all the photos produced by the search and drag them into the album.
    You can drag photos into any order in Albums and they remain in your chosen order.
     

  • Explain Plan for same query

    Same query is taking different times in two databses.
    Both dababases are similar being refreshed from one.
    Below are the the explain plan from both queries.
    Can anything be conclusive from this information.
    Second explain plan is for a faster execution.
    SELECT STATEMENT ALL_ROWSCost: 245,393
    18 PX COORDINATOR
    17 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10003 Cost: 245,393 Bytes: 735,679,824 Cardinality: 8,359,998
    16 HASH GROUP BY PARALLEL_COMBINED_WITH_PARENT Cost: 245,393 Bytes: 735,679,824 Cardinality: 8,359,998
    15 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 198,164 Bytes: 735,679,824 Cardinality: 8,359,998
    14 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 Cost: 198,164 Bytes: 735,679,824 Cardinality: 8,359,998
    13 HASH JOIN PARALLEL_COMBINED_WITH_PARENT Cost: 198,164 Bytes: 735,679,824 Cardinality: 8,359,998
    4 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD
    3 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 15 Bytes: 129,220 Cardinality: 2,485
    2 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 15 Bytes: 129,220 Cardinality: 2,485
    1 TABLE ACCESS FULL TABLE myschema.team Cost: 15 Bytes: 129,220 Cardinality: 2,485
    12 TABLE ACCESS BY LOCAL INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT myschema.mytable Cost: 18,117 Bytes: 4,777,136 Cardinality: 183,736
    11 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT Cost: 198,125 Bytes: 300,959,928 Cardinality: 8,359,998
    8 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD
    7 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT
    6 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10001
    5 TABLE ACCESS FULL TABLE myschema.dim Cost: 12 Bytes: 450 Cardinality: 45
    10 PX PARTITION RANGE ITERATOR PARALLEL_COMBINED_WITH_CHILD Cost: 38 Cardinality: 183,736 Partition #: 17
    9 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT myschema.IDX_TDATE_DC_FLAG Cost: 38 Cardinality: 183,736 Partition #: 17
    SELECT STATEMENT CHOOSECost: 2,830
    14 PX COORDINATOR
    13 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10003 Cost: 2,830 Bytes: 21,327,392 Cardinality: 288,208
    12 HASH GROUP BY PARALLEL_COMBINED_WITH_PARENT Cost: 2,830 Bytes: 21,327,392 Cardinality: 288,208
    11 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 2,828 Bytes: 21,327,392 Cardinality: 288,208
    10 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 Cost: 2,828 Bytes: 21,327,392 Cardinality: 288,208
    9 HASH JOIN BUFFERED PARALLEL_COMBINED_WITH_PARENT Cost: 2,828 Bytes: 21,327,392 Cardinality: 288,208
    4 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD
    3 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 19 Bytes: 129,272 Cardinality: 2,486
    2 PX SEND HASH PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 19 Bytes: 129,272 Cardinality: 2,486
    1 TABLE ACCESS FULL TABLE myschema.team Cost: 19 Bytes: 129,272 Cardinality: 2,486
    8 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 2,808 Bytes: 6,340,576 Cardinality: 288,208
    7 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10001 Cost: 2,808 Bytes: 6,340,576 Cardinality: 288,208
    6 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD Cost: 2,808 Bytes: 6,340,576 Cardinality: 288,208 Partition #: 13 Partitions accessed #1 - #5
    5 MAT_VIEW REWRITE ACCESS FULL MAT_VIEW REWRITE PARALLEL_COMBINED_WITH_PARENT myschema.matv_2 Cost: 2,808 Bytes: 6,340,576 Cardinality: 288,208 Partition #: 13 Partitions accessed
    Edited by: user610910 on Feb 13, 2009 5:12 AM

    SELECT STATEMENT CHOOSE Cost: 2,830
    14 PX COORDINATOR
    13 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10003 Cost: 2,830 Bytes: 21,327,392 Cardinality: 288,208
           12 HASH GROUP BY PARALLEL_COMBINED_WITH_PARENT Cost: 2,830 Bytes: 21,327,392 Cardinality: 288,208
               11 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 2,828 Bytes: 21,327,392 Cardinality: 288,208
             10 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 Cost: 2,828 Bytes: 21,327,392 Cardinality: 288,208
         9 HASH JOIN BUFFERED PARALLEL_COMBINED_WITH_PARENT Cost: 2,828 Bytes: 21,327,392 Cardinality: 288,208
                 4 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD
            3 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 19 Bytes: 129,272 Cardinality: 2,486
          2 PX SEND HASH PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 19 Bytes: 129,272 Cardinality: 2,486
    1 TABLE ACCESS FULL TABLE MYSCHEMA.TEAM Cost: 19 Bytes: 129,272 Cardinality: 2,486
    8 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 2,808 Bytes: 6,340,576 Cardinality: 288,208
         7 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10001 Cost: 2,808 Bytes: 6,340,576 Cardinality: 288,208
       6 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD Cost: 2,808 Bytes: 6,340,576 Cardinality: 288,208    Partition #: 13 Partitions accessed #1 - #5
    5 MAT_VIEW REWRITE ACCESS FULL MAT_VIEW REWRITE PARALLEL_COMBINED_WITH_PARENT  MYSCHEMA.MATVW Cost: 2,808 Bytes: 6,340,576 Cardinality: 288,208 Partition #: 13 Partitions accessed #1 - #5
    SELECT STATEMENT ALL_ROWSCost: 245,393
    18 PX COORDINATOR
        17 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10003 Cost: 245,393 Bytes: 735,679,824 Cardinality: 8,359,998
          16 HASH GROUP BY PARALLEL_COMBINED_WITH_PARENT Cost: 245,393 Bytes: 735,679,824 Cardinality: 8,359,998
              15 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 198,164 Bytes: 735,679,824 Cardinality: 8,359,998
                14 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 Cost: 198,164 Bytes: 735,679,824 Cardinality: 8,359,998
                       13 HASH JOIN PARALLEL_COMBINED_WITH_PARENT Cost: 198,164 Bytes: 735,679,824 Cardinality: 8,359,998
    4 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD
         3 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT Cost: 15 Bytes: 129,220 Cardinality: 2,485
             2 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 15 Bytes: 129,220 Cardinality: 2,485
                 1  TABLE ACCESS FULL TABLE MYSCHEMA.TEAM Cost: 15 Bytes: 129,220 Cardinality: 2,485
    12 TABLE ACCESS BY LOCAL INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT MYSCHEMA.MY_TABLE Cost: 18,117 Bytes: 4,777,136 Cardinality: 183,736
         11 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT Cost: 198,125 Bytes: 300,959,928 Cardinality: 8,359,998
        8 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD
              7 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT
                       6 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10001
                          5 TABLE ACCESS FULL TABLE MYSCHEMA.DIM Cost: 12 Bytes: 450 Cardinality: 45
    10 PX PARTITION RANGE ITERATOR PARALLEL_COMBINED_WITH_CHILD Cost: 38 Cardinality: 183,736 Partition #: 17
               9 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT MYSCHEMA.MY_IDX Cost: 38 Cardinality: 183,736 Partition #: 17 I think this one looks better.

  • Problem with group by/order by clause when using huge data

    Hi,
    I'm using below query on my table of size more than 210 million rows.
    SELECT booking_date FROM T_UTR
    WHERE four_eyes_status = 'A' AND booking_date <= '01-jul-2005' AND booking_date >= '01-jan-2004'
    AND invoice_id IS NULL AND link_id = 12345
    AND billing_indicator = 'L'
    GROUP BY booking_date ORDER BY booking_date
    If I'm skipping last line "GROUP BY booking_date ORDER BY booking_date", its giving me immediate result, but, because of group by/order by, the query may take 30 seconds to 2 minutes based on the data fetched for the date range. It may vary from 2 to 2 million rows, & grouping by for so many rows at run time will automatically take some time.
    Here I want to know, is there any procedure in oracle(any function based index) so that I can store/retrieve distinct values for link_id, & booking_date without grouping them at run time. Or the performance of the query can be increased
    Thanks
    Deepak

    Hi,
    You can use Materialized Views as stated earlier - specifically by using Query Rewrite. If the conditions on columns "four_eyes_status", "invoice_id", and "billing_indicator" never change in your query - then you can create a Materialized View that is targeted for those conditions and has lower cardinality (since you aren't grouping by those columns). The "COUNT(*)" allows the use of the DISTINCT operator in addition to "GROUP BY' as well for Query Rewrite.
    Create the Materialized View like this:
    CREATE MATERIALIZED VIEW test_mv1
    BUILD IMMEDIATE
    USING NO INDEX
    REFRESH FORCE ON DEMAND
    ENABLE QUERY REWRITE
    AS
    SELECT booking_date
         , link_id
         , COUNT(*) AS count_star
    FROM T_UTR
    WHERE four_eyes_status = 'A'
      AND invoice_id IS NULL
      AND billing_indicator = 'L'
    GROUP BY booking_date
           , link_id ;To improve performance further - create an index on the "LINK_ID" column like this:
    CREATE INDEX test_mv1_link_id_idx
    ON test_mv1 (link_id);Then - gather stats immediately on the Materialized View so that the CBO can use it for rewriting your original query - like this:
    BEGIN
       DBMS_STATS.gather_table_stats (ownname               => USER
                                    , tabname               => 'TEST_MV1'
                                    , partname              => NULL
                                    , estimate_percent      => DBMS_STATS.auto_sample_size
                                    , block_sample          => FALSE
                                    , method_opt            => 'FOR ALL COLUMNS SIZE 1'
                                    , degree                => NULL
                                    , granularity           => 'ALL'
                                    , cascade               => TRUE
                                    , no_invalidate         => FALSE
    END;
    /Now - the CBO should be able to rewrite your original query to use the Materialized View - provided you set up your session for Query Rewrite like this:
    ALTER SESSION SET query_rewrite_enabled = TRUE;
    ALTER SESSION SET query_rewrite_integrity = ENFORCED; -- set this to whatever staleness you can tolerate - see the docs for details...Now - after setting up your session - try running your query with autotrace to see if it was rewritten...
    Good luck!
    Message was edited by:
    PDaddy

  • Getting first row in a group by order by sql

    Hi all,
    I'm having problems with the query below. What I want is to get a count of hotelid and group it then take the top result. My problem is that the version of oracle that I'm using is giving me errors because of the nested group by, order by. Is there any way around this?
    SELECT *
    FROM (SELECT agentid, hotelid, COUNT(hotelid) AS COUNT
    FROM akorders a, akworklist_summary b
    WHERE a.agentid = 1408946 AND
    a.akorderid = b.akorderid
    GROUP BY agentid, hotelid
    ORDER BY COUNT DESC)
    WHERE ROWNUM < 2
    TIA!
    Brian

    SELECT agentid, hotelid, COUNT(hotelid) AS COUNT
    FROM akorders a, akworklist_summary b
    WHERE a.agentid = 1408946 AND
    a.akorderid = b.akorderid
    GROUP BY agentid, hotelid
    HAVING COUNT(*) = (SELECT MAX(icount)
                       FROM (SELECT agentid, hotelid, COUNT(hotelid) AS icount
                             FROM akorders a, akworklist_summary b
                             WHERE a.agentid = 1408946 AND
                                   a.akorderid = b.akorderid
                                   GROUP BY agentid, hotelid ))

  • Same Query for both Main and Sub Report

    I have a report whichs works but I don't think i'm getting the data to both the Main Report and Sub Report in the most effcient manner...  I have a report that totals users call subject counts.  But then end user wishes to see all users total counts and the grand totals of call counts on the first page then then the breakdown of types of calls on subsuquent pages...  so I created a report with a subreport in the report header....  I use the same query in both the sub and main report... however it asks the user to enter the parameters once for the main report and once for the sub report... Parameters are both the same for each; month and year...  so it currently runs the query twice I want to run it once and use the data for both reports...  I group by name and then sum the call subject counts for the user totals... and in the sub report I hide the detail section and I'm just left with the sub total line for each user, then in the main report use the same grouping and suming again and I start a new page for every user... 
    Using CR 9
    Thanks for any advice
    Vincent

    i think you need to link the main report parameter with the subreport parameters inorder to pass the parameter values from main report to subreport. So right click on subreport and go to change subreport links and add parameter fields and select parameter fields from your subreport and un check the databse fields in subreport.
    Regards,
    Raghavendra.G

  • SDO_RELATE - EQUAL MASK - Different results on the same query

    Hello.
    I'm trying to find all spatial duplication in the point layer (using certain tolerance). That layer has q-tree spatial index and appropriate tolerance in the user_sdo_geom_metadata table (let's say 1 meter). I have SDO_VERSION=9.2.0.5.0.
    To perform that I use SDO_RELATE operator with EQUAL mask (I know that actually I can use other operators but lets consider EQUAL):
    SELECT /*+ ordered */t1.OBJECTID, /*+ ordered */t2.OBJECTID from points_table t1, points_table t2 WHERE t1.OBJECTID < t2.OBJECTID
    AND sdo_relate (t2.shape, t1.shape, 'mask=EQUAL querytype = JOIN') = 'TRUE'
    The problem is:
    If I create Q-tree index using SDO_LEVEL=8 query takes 10 minutes and returns lets say 1000 dup events
    If I create Q-tree index using SDO_LEVEL=10 query takes 20 seconds and returns lets say 996 dup events
    I'm confusing about that - Why the results are depend from SDO_LEVEL? For me it is more important then performanse.
    Those missed duplication events are really duplication events (point closer to each other than 1 meter) and SDO_DISTANSE for those particlar poins returns 0. It is correct, but SDO_RELATE monitors that those points are not equal.
    So how can I rely on the SDO_RELATE function? What SDO_LEVEL need I use to get correct results? I choosed Q-tree indexes because of performance I didn't get success to get result using R-tree indexes on big datasets at all.
    Regarding polylines:
    I suppose that I can get similar problem and for polylines (I’m also using same query to find dups polylines).
    Sometimes SDO_RELATE finds polylines which ones are not really equal in the specified tolerance (1 meter). All cases that I saw – it was simple segments which ones share only one vertex but the other ends are spatially disjoint more that 3 meters. Why SDO_RELATE finds such cases as EQUAL?
    Thank you very much in advance.

    Thank you Siva for advice.
    I've tried R-tree indexes and got reasonable performance on the tables with ~20k rows.
    But when I try to ran that query on the table (points) with 250k rows it takes forever :(.
    1) Create index:
    Create index nodes_idx on nodes(SHAPE) indextype is mdsys.spatial_index parameters ('LAYER_GTYPE=POINT initial=10m next=5m sdo_rtr_pctfree=10 pctincrease=0');
    /* actually 'initial=10m next=5m sdo_rtr_pctfree=10 pctincrease=0' options only decreased slightly performance */
    2) Execute query:
    SELECT /*+ ordered */t1.OBJECTID, /*+ ordered */t2.OBJECTID
    from nodes t1, nodes t2 WHERE t1.OBJECTID < t2.OBJECTID AND
    sdo_relate (t2.shape, t1.shape, 'mask=EQUAL querytype = WINDOW') = 'TRUE'
    Plan Explanation:
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 150M | 1095G| 505M|
    | 1 | NESTED LOOPS | | 150M| 1095G| 505M |
    | 2 | TABLE ACCESS FULL | NODES | 548K | 2043M| 411 |
    | 3 | TABLE ACCESS BY INDEX ROWID| NODES | 274 | 1047K| 505M|
    | 4 | DOMAIN INDEX | NODES_IDX | 27416 | | |
    As far as I understand, oracle reserved for that query 1095G of memory?! Is it really necessary for that simple query and how can it be possible?
    Regards, Denis.
    Message was edited by:
    Tenek

Maybe you are looking for

  • Oracle8i Personal Edition

    Hi Everyone! I purchased the Oracle 8i CD Pack (Release3), which comes with 8i PE. The installation goes very well. However, when I try to setup the Network Configuration, it doesn't find anything! Even if I create the listner, etc. I recently notice

  • Validate certificates from received XML document

    Hi, I'm new to the Cryto API and have read the Java Cert Path API Prog. Guide. But I'm still not crystal clear on some details. (1) In the code below, at (a), which certificate should I put in the selector? Note that the document may contain a chain

  • Oil & Gas server?

    Hi Experts, My client is petroleum company, so they use Oil & Gas version. I'm a new SD consultant, And I take care selling Gas, but I don't know how to choose which process. They buy LPG from GAS company then sell for their customer They sell LPG (L

  • No Business Objects visible in SES_ADMIN

    Hi , I have installed TREX and created RFC for the TREX. But I cannot see any Business Object in SES_ADMIN transaction. While I can see 504 BO's in the table TOJTB What could be missing ? Atleast the BO for the flight model shoudl come in SES_ADMIN C

  • Canon mx-360 scanner freezes

    We have an iMac running OSX 10.6.8. We have an attached multi-function Canon MX-360 which up until last week was working fine. We had to cancel a scan and the scan program froze. We executed a Force Quit and tried to re-scan but the ScanGear window f