you place your order in xquery-distinct values

I was surprised to see the return of the following different results, is this a bug in the XML Query rewrite, or is the order of not only guaranteed the distinct values?

Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

With partitioning, OLAP, Data Mining and Real Application Testing options

SQL > SELECT XMLQUERY)

2 ' (string code points

3 distinct-values ((99,98,97)))'

4 ELECTION CONTENT) result

5 FROM dual;

RESULT

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

ABC

SQL > SELECT / * + NO_XML_QUERY_REWRITE * /.

() 2 XMLQUERY

3 ' (string code points

distinct-values ((99,98,97))) 4'

5 ELECTION CONTENT) result

6 FROM dual;

RESULT

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

CBA

SQL >

Hello

The specs say the order is "dependent application": fn: distinct values

Summary so is (I guess), strict language point of view, should not rest on any apparent order in the resulting sequence.

The results collected by the two queries probably be different for the same reason: different implementation.

First one with XQuery Rewrite active is solved using the SQL operators and functions, something along these lines:

SELECT 'CODEPOINT2STR_FUNC' ('SEQUENCE')

DE)

SELECT 'AGGREGATE_FUNC' (VALUE (T) SEPARATE) "SEQUENCES".

TABLE ("SEQUENCE_FUNC"(99, 98, 97)) T

) ;

While the second is evaluated by the XVM and apparently maintains the original order.

Tags: Database

Similar Questions

  • you place your order of rows based on the values

    Hello

    I have two tables for example: emp1 emp2 and
     emp1 
      
    AD_NAME     VD     COURSE_NOS
    ------------------------------
    AD1           100     3
    AD2              2     2
    AD3             50     5
    
    emp 2
    
    AD_NAME     COURSE
    -------------------------
    
    AD1              C1
    AD1              C2
    AD1              C3
    AD2              C1
    AD2              C2
    AD3           C1
    AD3              C2
    AD3              C3
    AD3              C4
    AD3              C5
    
    i want to order the ad_name of emp2 based on  highest vd order of emp1 but the order should be for alternative vd
    
    like
    
    AD1       100
    AD3         50
    AD2           2
    AD1        100
    AD3          50
    AD2            2
    .
    .
    
    .
    AD3          50        
    Published by: vishnu prakash on Sep 8, 2010 04:40

    You mean, more like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with emp1 as (select 'AD1' as ad_name, 100 as vd, 3 as course_nos from dual union all
      2                select 'AD2', 2, 2 from dual union all
      3                select 'AD3', 50, 5 from dual union all
      4                select 'AD4', null, 2 from dual)
      5      ,emp2 as (select 'AD1' as ad_name, 'C1' as course from dual union all
      6                select 'AD1', 'C2' from dual union all
      7                select 'AD1', 'C3' from dual union all
      8                select 'AD2', 'C1' from dual union all
      9                select 'AD2', 'C2' from dual union all
     10                select 'AD3', 'C1' from dual union all
     11                select 'AD3', 'C2' from dual union all
     12                select 'AD3', 'C3' from dual union all
     13                select 'AD3', 'C4' from dual union all
     14                select 'AD3', 'C5' from dual union all
     15                select 'AD4', 'C1' from dual union all
     16                select 'AD4', 'C2' from dual)
     17  --
     18  -- END OF TEST DATA
     19  --
     20  select ad_name, vd, course_nos, course
     21  from (
     22        select emp1.ad_name, vd, course_nos, course
     23              ,row_number() over (partition by emp1.ad_name order by decode(vd,null,1,0), course) as crn
     24        from emp1 join emp2 on (emp1.ad_name = emp2.ad_name)
     25       )
     26* order by decode(vd,null,1,0), crn, vd desc nulls last
    SQL> /
    
    AD_         VD COURSE_NOS CO
    --- ---------- ---------- --
    AD1        100          3 C1
    AD3         50          5 C1
    AD2          2          2 C1
    AD1        100          3 C2
    AD3         50          5 C2
    AD2          2          2 C2
    AD1        100          3 C3
    AD3         50          5 C3
    AD3         50          5 C4
    AD3         50          5 C5
    AD4                     2 C1
    AD4                     2 C2
    
    12 rows selected.
    
    SQL>
    

    ?

  • You place your order by number Char field

    I have a char with data field.

    Required order is lower.

    Column1

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

    12

    12-A

    12-B

    122

    122-A

    122-C

    123

    123-A

    123-B

    I have to order both at the level of form and report.

    Pasha

    Lahore, Pakistan

    The 'trick' is pad strings or a part of them to the same length. In your case, it may be sufficient for the whole string if lpad suffix (A, B, C) are always of length 1.

    Otherwise, you will need to split the string at the position of the hyphen and lpad for both parties.

    Ah, now I see that you do not always have a suffix. Just so add an artificially.

    As the length, you must choose a value greater or equal to the maximum length of the string or their parts RESP.

    order by lpad (decode (instr (column1,'-'), 0, column1 |)) ((' - 0', column1), 10, '0')

    or

    Select Column1 from)

    Select

    Column1

    , max (length (decode (instr (column1,'-'), 0, column1 |))) (((' - 0', column1))) on len)

    tab

    )

    order by (lpad, len, '0')

  • You place your order on the Apple Site

    I ordered a 7 IPhone September 21, as it was very
    hard to get one at the store here in Rome, Italy
    at that time. Today, 7 October, I see that the IPhone is available to any
    store, but I have still not received my... and shipping follow-up shows that
    the phone is always located in Amsterdam, Holland. This means that it will be
    probably need another 7 days to be delivered to me! Now, I want to only disclose my
    concern that I think that what makes an online prescription should be advantaged
    otherwise it's not really a reason to buy
    an article on the Web Site!

    And this is the last time I'll do so!

    Thank you!

    Greetings from Rome

    !

    Don't know what your question on the iTunes Store, but you already know that you talk only to other users on these forums and that Apple are not here - if you want to contact Apple using the 'contact us' link at the bottom right of each page here.

  • You place your order of cross-directories

    Hello

    I need your help.

    I want to browse directories and order all the files by date.

    I used this command:

    cmd /c dir "c:\nuovacartella" / b/s A:-D / o:-d

    but the files are classified at the folder level.

    See the example:

    /C dir "c:\nuovacartella" C:\>cmd / b/s /A:-D / TC o:d

    c:\nuovacartella\cartella file\uno.txt

    c:\nuovacartella\cartella file\AAA\ciao.txt

    c:\nuovacartella\cartella file\AAA\due.doc

    c:\nuovacartella\cartella file\AAA\tre.xsl

    c:\nuovacartella\cartella file\AAA\appenaCreato.rar

    c:\nuovacartella\cartella file\BBB\B2\son a file.txt

    file Link\son a c:\nuovacartella\cartella

    c:\nuovacartella\cartella Link\uno

    c:\nuovacartella\cartella Link\appenaCreato

    c:\nuovacartella\cartella Link\ciao

    /C dir "c:\nuovacartella" C:\>cmd / b/s /A:-D / TC o:-d

    c:\nuovacartella\cartella file\uno.txt

    c:\nuovacartella\cartella file\AAA\appenaCreato.rar

    c:\nuovacartella\cartella file\AAA\tre.xsl

    c:\nuovacartella\cartella file\AAA\due.doc

    c:\nuovacartella\cartella file\AAA\ciao.txt

    c:\nuovacartella\cartella file\BBB\B2\son a file.txt

    c:\nuovacartella\cartella Link\ciao

    c:\nuovacartella\cartella Link\appenaCreato

    c:\nuovacartella\cartella Link\uno

    file Link\son a c:\nuovacartella\cartella

    but I want the files classified into cross-folder.

    Is it possible to do so (for example, using a batch script)?

    Thanks in advance. Leonardo

    Hi Leon,

    Thanks for posting your question in the Microsoft Community!

    I suggest you to ask your question on the MSDN Forums.

    http://social.msdn.Microsoft.com/forums/en-us/categories

    Hope this hslps.

  • You place your order by comparing - SQL Experts pls help

    Hi all

    I want to measure the closest points according to the percentage between these points and order.
    in other words, I want to show the relationship between the points according to the percentage value.
     
    drop table temp_value; 
    create table temp_value(id number(10),location varchar2(20), percentage number(9)); 
    
    
    insert into temp_value values  (1,'LOC 1,2',30); 
    insert into  temp_value values (2,'LOC 1,3',0); 
    insert into  temp_value values (3,'LOC 1,4',0); 
    insert into  temp_value values (4,'LOC 1,5',0); 
    insert into  temp_value values (5,'LOC 1,6',50); 
    insert into  temp_value values (6,'LOC 2,3',0); 
    insert into  temp_value  values(7,'LOC 2,4',0); 
    insert into  temp_value values (9,'LOC 2,5',0); 
    insert into  temp_value values (10,'LOC 2,6',10); 
    insert into  temp_value values (11,'LOC 3,4',90); 
    insert into  temp_value values (12,'LOC 3,5',80); 
    insert into  temp_value values (13,'LOC 4,5',0); 
    insert into  temp_value values (14,'LOC 4,6',0); 
    insert into  temp_value values (15,'LOC 5,6',0); 
    I want the output like this, the ranking of the point like this
     
    4 
    3 
    5 
    6 
    1 
    2 
    or like this
      6 
    1 
    2 
    4 
    3 
    5 
    If you ask me why I say this ranking only
     
    
    4    [90 percent between point 3,4 that mean can be 3,4 or 4,3] 
    3 
    5    [80 percent between 3,5 that mean can be 5 after 3,4] 
    6    [50 percent between 1,6 that mean can be 1,6 or 6,1 ] 
    1 
    2    [ 30 percent between 1,2 that mean can be 1,2 or 2,1] 
    concerning

    Published by: Isabelle October 6, 2012 10:18

    Published by: Isabelle October 6, 2012 10:43

    Published by: Isabelle October 6, 2012 20:04
    SQL> select loc
      2  from(
      3  select loc,rownum rn
      4  from(
      5  select percentage,location,regexp_substr(location,'\d+',1,rn) loc
      6  from temp_value a,
      7       (select 1 rn from dual union all
      8        select 2 from dual ) b
      9  order by percentage desc,to_number(regexp_substr(location,'\d+',1,rn)) asc
     10  ))
     11  group by loc
     12  order by min(rn);
    
    LOC
    --------------------
    3
    4
    5
    1
    6
    2
    
    6 rows selected.
    
  • Preloader you place your order

    Hi, I'm replenish items are several tutorials on different sites to create my own slideshow based on xml with correlated images. It works great except that I am not able to control the order in which the images are loaded. They get loads in the order that they are downloaded, not in order of my XML file. It is that is causing the links and other attributes that I put in my xml doc, to fall out of sync.

    I guess that there is a way to push my items in a specific order, or make sure that the additional attributes are loaded at the point where the image is pushed into the table. I guess some context would help (see attached code)

    I think that I have provided all the relevant information, but if you need to see another feature let me know.

    Yet once, in charge of everything very well when I test locally, it's just that the order is out of sync when I actually download the items. The heavier images are transferred backward, even though these attributes are in the right order.

    I really wish to keep pictures in the order of the XML doc, but if this is not possible I need to at least be able to make sure that the attribute values are assigned to the correct image container. I don't know where and how.

    Thanks in advance!

    Try:

  • You place your order of Vista recovery disc

    Hello

    Have a Pavilion DV9000 (Service Tag: DV9824CA).  I lost my HD... need to replace.  Unfortunately, I didn't create the recovery discs when HD was alive (stupid me).

    I ordered the Kit of recovery Vista Home Premium 32B dual language at HP ($45).  The package came with only 1 DVD.  It is clearly stated on the DVD (1 of 2).  During the installation of the first DVD... He injects and asks for DVD #2... surprise, surprise... after many calls with HP support, they insist that this is a single DVD.

    Am I missing something here?

    Thank you!

    FYI... received a letter of apology from HP and 2 recovery DVDs Vista.

  • You place your order for recovery disc for mini 110

    Hello world

    first of all, I say this isn't really a laptop, I have a mini 110-3610sa.

    I've upgraded to windows 7 Professional to windows 7 basic, whatever he was going well until I stopped

    I lost the HP quick web and also the restoration of the factory, it goes to the windows recovery.

    can help you, I would really like to have fast web back it was very good and I was getting just configured with e-mails and fav sites.

    any help

    Ron tinydamed

    You can order recovery disks by following the instructions in the link below

    http://h20000.www2.HP.com/bizsupport/TechSupport/document.jsp?objectID=c00810334

  • You place your order and updates

    HI, I would ask it is possible for me to order here online and have it shipped here in the Philippines? If so, would I be able to get updates? Intend to buy the razr maxx hd in the future

    * Motorcycle shops here still does not sell the razr maxx. Thought about buying from ebay but the maxx HD came.

    Thank you. Nice day.


  • You place your order of media 64 bit for Vista

    I have a copy of Windows Vista 32-bit, but I need now support 64-bit. I can't find anywhere on the Microsoft site where to apply to. The card provided in the area is reference to www.windowsvista.com/1033/ordermedia, but it takes you just for the generic marketing of Windows Vista site. It is still available, and if so someone can give me a link to order the media? Thank you.

    Hello

    Microsoft used to have 64 bit for vista32 bits edition only shipping cost detail

    It was the link

    http://www.Microsoft.com/windowsvista/1033/ordermedia/default.mspx

    It seems that it is discontinued that microsoft is passed to windows 7

  • you place your order for WCS with MSE

    When ordering WCS with MSE, is that all that you need for WCS?

    WCS-STANDARD-K9 ($0) + WCS-MORE-500 ($44. 5 K)

    In the past, we ordered WCS-APLOC-500. WCS-PLUS-500 replace it?

    When you are not using MSE is WCS-APBASE-500?

    Yes, you just need standard + more to integrate with MSE. Plus also gives you high availability which is a nice feature. Most replaced Loc.

    Link below will give you all the information you need.

    http://www.Cisco.com/en/us/prod/collateral/wireless/ps5755/ps6301/ps6305/product_data_sheet0900aecd804b4646.html

    And the Base MSE/WIPS/HA.

    See you soon

    Carpet

  • You place your order of SNS-3415

    I ordered the SNS-3415 as ISE 1.1.4.

    I thought I have to install the ISE, however, it has been installed.

    but I don't know what is the ID/PW...

    No one knows about it?

    Hello

    You'll have to reimage, on a new installation, you should be presented with invites it installation.

    Tarik Admani
    * Please note the useful messages *.

  • You place your order of behavior in subclasses of Test

    The behavior of command between hereditary test classes seems to have changed between FlexUnit 4 and 4.1 beta 2.

    Here is the order in which my test methods are running:

    Subclass [After (order = 9)]

    Subclass [After (order = 10)]

    BaseClass [After (order = 1)]

    4.0 did:

    BaseClass [After (order = 1)]

    Subclass [After (order = 9)]

    Subclass [After (order = 10)]

    I think that the old behavior is correct... maybe a bug here?

    Thank you

    Brian

    Yes, you are right and I also discovered this morning. I have a potential problem I look now and it will grow up to my branch today.

    I can get an early version to test against and ensure absolutely that what forwards RC1

    Mike

  • you place your order in ODI

    I use ODI to create the flat file to another flat file. No transformation. But every time that I run the interface its change of the order of the content. Is there a setting in the Interface, I can choose which avoids the problem of control change.

    -app

    If there is no transformation, then why can't you use OdiFileCopy instead?

    Interfaces to do any processing on relational tables and there is no notion of an order in relational algebra.

    But if you insist, you need to change the KMs service to specify the order clause. There is no switch in an interface to do.

Maybe you are looking for

  • password and forgetts appleID

    If a friend foretts his apple id and password how do we get him on the ipad or the i phone

  • Control SMART and short CIOS not installed? New notebook

    Hello My parents sent me the 4440 s of HP Probook. I turned it on and it was working fine. No problem at all, but the hard drive was very small. Only 59 concerts. So, I took the hard drive from my old laptop (which still works. 300 concerts) and put

  • How to access the BIOS on Satellite Pro A120

    Sorry for my English.But I need help: How to access the BIOS on my Satellite Pro A120

  • Bootcamp partition unusable after the failed kidnapping attempt

    Hi, I'm having a problem with my Imac, for reference, it is a model of 2013 with an Intel i5, 32 GB of ram and a 250 GB ssd.  I got it initially setup with a partition boot camp of 100 GB running windows 7 but windows encountered problems and wouldn'

  • output of the script in excel

    I have some script online, could you please help me add output in an excel sheet.SE connect-VIServer server1 $report# Specifies the location of the output file$filemame = 'C:\dir1\ESX_info.xls'Get-VMHost | Select name, Version, Build,@{N = "Cluster n