By default in "in order to" in the query select can be different in 11g 10g

Hi, I wonder if, when you are querying a table 11g and that you use the order by clause and there are several occurrences with the same values in the order, if the default value of the 11g is different from 10g.  For example.

DECLARE MHBulk CURSOR FOR

Select invoice_nbr,

customer_nbr,

post_century,

post_yymmdd,

CUSTOMERS

where customer_nbr = 1234

order by

post_century,

post_yymmdd;

If you have several occurrences of the same customer_nbr, post_century and post_yymmdd that it looks like the order by default for how 11g retrieves records is a little different from the default value of 10g.   Does anyone know why this is?

"The mechanism in which database Oracle sorts character values for the ORDER BY clause, also known as the name of the collation is specified by the NLS_SORT parameter of session."

If this parameter is not set, its default value is derived from the NLS_LANGUAGE parameter of the session. "

http://docs.Oracle.com/CD/E11882_01/server.112/e41084/queries005.htm#SQLRF52348

Perhaps these parameters are defined differently?

The columns (post_century, post_yymmdd) always scare me, by the way...

Tags: Database

Similar Questions

  • How do the query select outer join to a report of the APEX

    Hi all

    I'm Ann.

    I have a select statement that is used to calculate statistics for a month (October 2012 in this example)
    Select ph.phase_number
    sum ((case
    WHEN ph.date_finished IS NULL or ph.date_finished > last_day (TO_DATE (' ' Oct 2012 ', ' MY YYYY' "))
    THEN last_day (TO_DATE (' ' Oct 2012 ', ' MY YYYY' "))
    Of OTHER ph.date_finished
    END)
    (-ph.date_started + 1) / count (def.def_id) as avg_days
    Ph phase_membership
    inner join court_engagement this on ph.mpm_eng_id = ce.engagement_id
    join in-house defendant def on ce.defendant_id = def.def_id
    where def.active = 1
    and ph.date_started < = last_day (TO_DATE (' ' Oct 2012 ', ' MY YYYY' "))
    and ph.active = 1
    and UPPER (ce.court_name) LIKE '% '.
    Rollup Group (phase_number)
    ;

    The result is as below
    Phase_Number AVG_DAYS
    Phase One 8.6666666666666667
    Phase two 14.6
    Phase three 12
    11.4615365

    I have another list of selection mainly the list of months between two date value.
    Select to_char (which_month, 'LUN YYYY') as display_month
    de)
    Select add_months (to_date (' ' August 2012 ', ' MY YYYY' "), rownum-1) which_month
    of object
    where
    rownum < = months_between (to_date (' ' Oct 2012 ', ' MY YYYY' "), add_months (to_date (' ' August 2012", "MY YYYY"), - 1))
    order of which_month)

    The query result is as below

    DISPLAY_MONTH

    AUGUST 2012
    SEP 2012
    OCT 2012

    Is it possible I can join these two select statement above to generate a comparable result:

    Days of month Phase number Avg
    August 2012 Phase One 8.666
    Sep 2012 Phase One 7.66
    Oct 2012 Phase One 5,66
    August 2012 Phase two 8.666
    Sep 2012 Phase two 7.66
    Oct 2012 Phase two 5,66
    August 2012 Phase three 8.666
    Sep 2012 Phase three 7.66
    Oct 2012 Phase three 5,66

    Or
    Days of month Phase number Avg
    August 2012 Phase One 8.666
    August 2012 Phase two 7.66
    August 2012 Phase three 5,66
    Sep 2012 Phase One 8.666
    Sep 2012 Phase two 7.66
    Sep 2012 Phase three 5,66
    Oct 2012 Phase One 8.666
    Oct 2012 Phase two 7.66
    Oct 2012 Phase three 5,66

    And it can be controlled by Phase number or month.
    My other colleague suggested I should use a left outer join, but after having tried many ways, I'm still stuck.

    I tried select is
    Select a.display_month, b.* in)
    Select to_char (which_month, 'LUN YYYY') as display_month
    de)
    Select add_months (to_date (' ' August 2012 ', ' MY YYYY' "), rownum-1) which_month
    of object
    where
    rownum < = months_between (to_date (' ' Oct 2012 ', ' MY YYYY' "), add_months (to_date (' ' August 2012", "MY YYYY"), - 1))
    order which_month)) a left outer join

    (Select to_char (ph.date_finished, 'MY YYYY') as join_month, ph.phase_number)
    sum ((case
    WHEN ph.date_finished IS NULL or ph.date_finished > last_day (TO_DATE (a.display_month, 'MY YYYY'))
    THEN last_day (TO_DATE (a.display_month, 'MY YYYY'))
    Of OTHER ph.date_finished
    END)
    (-ph.date_started + 1) / count (def.def_id) as avg_days
    Ph phase_membership
    inner join court_engagement this on ph.mpm_eng_id = ce.engagement_id
    join in-house defendant def on ce.defendant_id = def.def_id
    where def.active = 1
    and ph.date_started < = last_day (TO_DATE (a.display_month, 'MY YYYY'))
    and ph.active = 1
    and UPPER (ce.court_name) LIKE '% '.
    To_char (ph.date_finished, 'MY YYYY'), group (phase_number) rollup) b
    On a.display_month = b.join_month

    but then I get an error
    SQL error: ORA-00904: "A." "" DISPLAY_MONTH ": invalid identifier

    I need to view a report on the APEX with option for people to download at least format CSV.
    Already 1 inteactive report in the page, so I don't think adds another interactive report without using the iframe trick.

    If any of you have any ideas, please help.

    Thank you very much.

    Ann

    Hello Ann,.

    Frank has done a very good job. I am also impressed.

    Is in regard to your correction to his question, the problem is on this replacement you did

    last_day(TO_DATE(am.which_month,'MON YYYY'))
    

    AM.which_month is already a date type, and you don't need to convert it to this day.
    Here is the correct way:

    last_day(am.which_month)
    

    There are also sometimes with the data you've posted have no line for this month. So I also added a function NVL to display 0 under avg_days for these cases.

    Here is my corrected query:

    DEFINE startmonth = "Aug 2012";
    DEFINE endmonth   = "Oct 2012";
    WITH  all_months  AS
    (
       SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
       ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
       from all_objects
       where
       rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
    )
    SELECT TO_CHAR (am.which_month, 'Mon YYYY')  AS month
         , ph.phase_number
         , NVL(sum ( (CASE
                     WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
                     THEN last_day(am.which_month)
                     ELSE ph.date_finished
                  END
                 ) - ph.date_started + 1
               ) / count(def.def_id), 0) as avg_days
      FROM all_months am
           LEFT OUTER JOIN  a_phase_membership  ph  PARTITION BY (ph.phase_number)
              ON  am.which_month <= ph.date_started
              AND am.next_month  >  ph.date_started
              AND ph.date_started <= last_day(am.which_month)  -- May not be needed
              AND ph.active = 1
           LEFT OUTER JOIN  a_engagement  ce
              ON  ph.mpm_eng_id = ce.engagement_id
              AND ce.court_name IS NOT NULL  -- or something involving LIKE
           LEFT OUTER join  a_defendant     def
              ON  ce.defendant_id = def.def_id
              AND def.active = 1
     GROUP BY ROLLUP(phase_number, am.which_month)
     ORDER BY  am.which_month
            ,  ph.phase_number
    ;
    
    The output is:
    MONTH    PHASE_NUMBER           AVG_DAYS
    -------- -------------------- ----------
    Aug 2012 PHASE ONE                     0
    Aug 2012 PHASE THREE                   0
    Aug 2012 PHASE TWO                     0
    Sep 2012 PHASE ONE                    12
    Sep 2012 PHASE THREE                   1
    Sep 2012 PHASE TWO                     9
    Oct 2012 PHASE ONE                     8
    Oct 2012 PHASE THREE                   0
    Oct 2012 PHASE TWO                    14
             PHASE ONE                    11
             PHASE THREE                   1
             PHASE TWO                  11.5
                                  9.71428571
    

    I don't know if that's really what you want. In the case check it and let me know.

    Kind regards.
    Al

  • Rewrite the query, select below or try to get the necessary O/P

    Hello..

    My example of data.,.

    Create table customer (name varchar2 (10), telephone1 telephone2 number (10), number of phone3 (10), (10) number, bitwisephone number (10));

    Insert into customer values('a',23456,67890,null,12345);

    Insert into customer values ('b', 67459,89760,null, 37689);

    create table do_not_call (dont_call number (10));

    insert into do_not_call values (67890);

    insert into do_not_call values (37689);

    Question: -.
    --------------

    Customer 'a' has value of numbers1 as 23456.check if telephone1 exists in the do_not_call table.
    In fact there is no, so set the bit for numbers1 as "o" like wise search telephone2
    & phone3.after update of the bitwisephone for each client should be as the output below.


    Need to O/P: -.
    -------------------

    name bitwisephone

    a 010
    b 001


    For that matter... I use "any" operator...



    SELECT name, case when numbers1 = all (SELECT dont_call FROM do_not_call) and then put an end to '1' other '0'.
    -case when telephone2 = all (SELECT dont_call FROM do_not_call) and then put an end to '1' other '0'.
    -case when phone3 = all (SELECT dont_call FROM do_not_call) then '1' other '0' end 'Bits '.
    OF THE customer;


    Is there any other way to get the necessary O/P?


    Thank you!!

    Kind regards
    VijayRajaram.

    Looks like one already answered Re: rewrite the query, select below or try to get the necessary O/P

    with
    customer(name,phone1,phone2,phone3,bitwisephone) as
    (select 'a',23456,67890,12345,null from dual union all
     select 'b',67459,89760,37689,null from dual
    ),
    do_not_call(dont_call) as
    (select 67890 from dual union all
     select 23456 from dual union all
     select 37689 from dual
    )
    select name,
           to_char(mod(trunc(sum(weight)/4),2))||
           to_char(mod(trunc(sum(weight)/2),2))||
           to_char(mod(sum(weight),2)) bitwisephone
      from (select name,phone1 phone,4 weight
              from customer
            union all
            select name,phone2,2
              from customer
            union all
            select name,phone3,1
              from customer
           ) c,
           do_not_call d
     where c.phone = d.dont_call(+)
       and d.dont_call is not null
     group by name
    

    Please do not duplicate messages

    Concerning

    Etbin

  • Number of lines on the query and export are different?

    Hello

    I'm kinda new to SQL Developer, but so far it has been very well. I came across a problem, but with a certain query I count the lines and get about 11 000 (which is what I expected), and then export the data to a csv file to download on another system, and somehow the number of lines is increased to 30,000? I tried several times and still get the same results, and I know that the extra lines should not be returned to request bythe they fail when uploaded to the other system.

    Does anyone have any idea why this could be? The query is a union query, but it was fine before. Looks like a bug to me, but then again that I am a newbie.

    Thank you

    Steve

    The recordtypeextract r table is not related to any other table. Link with another table and avoid the Cartesian join.

  • Trigger of the ISO (behavior?) behavior different in 11g (works of 10g, 11g not)

    We have a two master tables, A and B connected by an xref, AB, who has the key to A column and the column key of B... each help-offer combo can only happen once.

    A may have 0 to many Bs, B can be 0 to many as.

    (these tables describe a pool of 'work'... the work can start at different points... If there is flow and life is good, it starts with A, becomes B and so a bond between them, but sometimes has never progresses to B... sometimes there are emergencies, and so B is created... each pool has a Master ID to itself)

    We have a view V1...
    Outer join B AB where corresponds to the button B (one column).

    ... we want to see Group B, if there a records, and as that may be related.

    We have another opinion V2... that selects in V1 where A key is not null.
    (we're too lazy to get another opinion that represents a join B - AB).

    We have a trigger to ISO on V2 (V2 is used by a form, but the problem is the DB level).

    In SQL Developer... in DB10g, V2 shows insertable ACE / ID.
    (the trigger handles all things, gets the data in the table AB, which is what cares the view).

    In SQL Developer... in DB11g, V2 DOES NOT SHOW UP insertable / suppressible.

    The same code in both places. We test 11g, in order to determine our "traps" before that we will occupy migrate.

    With the 10gDB behind the form, follows after a deletion.
    With the 11gDB behind the form, it gives a 'impossible to remove from the view' and begins to talk about keys preserved and row ID.

    Why?

    We know that the data is very good. We like the behavior of 10g.
    The V1 and V2 have good recordset and keys appropriate to AB, and B.

    Without re - write this and similarly built views, what do we do to make it work again?

    All the clues are welcome!

    SM

    SM_Work wrote:
    With the 11gDB behind the form, it gives a 'impossible to remove from the view' and begins to talk about keys preserved and row ID.

    Only one question here is you ;)

    And the facts of talking too much, too little hard.

    What is you get the exact error message?
    What do you do with her?
    ANSI joins is involved?
    Can error be reproduced using SQL * more?
    Looking for metalink? -A first guess could be Bug 14274321

    Could you post the view? -If possible, a version boiled down from it.

    Think I remember a similar discussion (without knowing what we are actually discussing)-finding something like 10g was too lenient and he failed, now 11g.

    Concerning
    Peter

  • The query selected several hierarchies of dimension levels

    Hi all.

    I've created a dimension with two hierarchies as follows customer by AWM 11.

    SLM_HIER: All clients-> seller-> client
    GEO_HIER: All clients-> status-> City-> client

    I also have a SALES_CUBE (measures: aggregation of QUANTITY, VALUE,: SUM) which is sized with Sun customer.

    I use OBIEE to query the OLAP engine (through the relational views that AWM created automatically). I followed the OTN OBE tutorials.

    I have the following query on the cube:

    Give me the AMOUNT where VENDOR = S1 and the CITY ("Athens", "Rome").

    Is it possible to have such a request? As far as I understand there is no aggregated data ready for some levels of two hierarchies.

    Thank you very much.

    Chris

    I think that OBIEE would also give you your answer of OLAP.

    This query has two hierarchies defined filters and (therefore OBIEE would need) automatically fix this request of the highest common level b/w hierarchies (in this case: base/leaf level - customer). Accordingly, if the CUSTOMER is your Customer dimension, OBIEE (at least, the old style of obiee modeling with olap) would introduce the security CUST_LEVEL = "Customer" filter Granularity of the result set returned would be for each customer. 1 card for each client meets the criteria of the VENDOR = "S1" and the CITY ("Athens", "Rome").

    Ideally, you should include the Cust Id columns quantity in your report of obiee answers and use a view/object of internal responses as a Pivot point of view to hide the column customer Details and get a localized aggregation staggered in the result set returned by OLAP to get the consolidated amount. Table of responses given at the customer level, answers Pivot can show the required result.

    Note1: The Cube cannot have this pre calculated result since it is a contradictory combination of filters in all hierarchies. Values of specific calculated level (or pre calculated) aggregation in the cube for level seller (h1) contain customers in all cities (h2) and same city level (h2) aggregates contain clients from all sellers (h1).

    Note 2: I believe OBIEE with OLAP modeling suffers from certain issues related to multiple hierarchies (for example: If you have the filter hierarchy by default only CITY ("Athens", "Rome"), I think it would always go for the lowest common level customer instead of the City level directly results).

    HTH
    Shankar

  • Take the tool does not. Take the tool selected - can see the hand but will not take anything

    Hello

    I'm new to photoshop and I am currently working through the tutorials on Lynda.com to learn as much as I can, but I'm stuck at the minute. Tutorials wants me to use the Snipping Tool to move an image and no matter what I do nothings moving. I selected the tool and see that it is selected and that the needle moves on the image but it is not striking, no selection.

    I also did with the letter to select the capture tool. Once again, this works, but will not take anything.

    Any entry in this problem would be highly appreciated. Thank you

    Hi Clara-beautiful,

    Hand tool is running when your image is enlarged and that you want to move to a specific part of the image.

    You must move your image with the mouse after a zoom once you have selected the hand tool.

    Are you a person following the same steps in workflow or other?

  • How to find the query select bind variables

    How to extract the variable name to bind to AS suite of sql queries
    ' SELECT NAME IN: NAME OF THE DOUBLE '
    or
    "SELECT * FROM WHERE DOUBLE (: NAME = NAME)".
    or
    "SELECT * FROM WHERE DOUBLE: NAME IS NULL'."
    or
    "SELECT * FROM WHERE DOUBLE: NAME | NAME = LAST_NAME'
    or
    ' SELECT * FROM DUAL WHERE: a = 10'
    or
    "SELECT * from where DOUBLE: A > = 10'.
    or
    "SELECT * from where DOUBLE: A < = 10 '.

    Give a solution using SUBSTR, REGEXP_SUBSTR, please answer quickly
    best answer will be marked correct/good...

    Search: and then search for the following word breaker then have the substr for them: and the separator.
    You can build an own function to find the same.

  • Logical operators in the query select Oracle

    Hi all

    Can I use the logical operators in queries select oracle?

    for 1 and 0 = 0; 1 or 0 = 0

    If I have a 1010 value two fields in a table COL1 and COL2 have a value of 0001.

    Is it possible to use select col1 or col2 from table? where or is a logical operator.

    Kind regards
    select bitand(6,8) from dual;
    
    BITAND(6,8)
    --------
    0     
    
  • Change the query to a display object

    I have a view currently, object based on an entity. It is the default view object, which means that the query the view object is frank, he grabs all the attributes of the table. And there is no WHERE clause.

    Actually, I only want to show a finite set of rows in my table. Whenever a record is modified/edited in this entity and committed, a new row in the database is created with the same information (I use CreateWithParams) with the exception of a few columns.

    I actually didn't really update it on this table, just creating new lines. But to the user, I want it 'looks' like they change something in the table.

    Example:

    12, 11:32, Thompson, 60 (changes to the user this information in a table of the adf and a new line is created in the comic book)

    12, 11:55, Thompson, 75





    I have a timestamp field (see above) in the database that is used as part of my primary key, while I know that is later.

    When executing the query of the VO, I want the user to only see as the last row of the db.

    12, 11:55, Thompson, 75

    Then...

    I went to my VO, and I changed the query WHERE to add this:

    where t1. TimeStamp = (Select MAX (t2. (TimeStamp) OF THE rcl.x t2 where t1.uid = t2.uid);


    Now, this isn't a question of mysql/sql. There is actually a better query I was running, but the editor of the VO does not allow me to change the query itself...

    When I save the new WHERE to my VO, rerun my page, I get the expected result (showing me only the latest recordings).

    However, when I try and do a sort on the table in which are displayed my data, I get now ORDER BY errors.

    I don't want my VO SQL read-only basis. I want to be able to update my table, so I have my VO running out of the entity.



    Why don't the VO allows me to change the query itself? (As do a subquery instead of having my where clause to do the job)

    Why are sorted by errors are thrown when I sort on my adf table after changing the where clause in my opinion?

    I hope I was not too complicated in explanation of my problem...

    Thanks in advance,

    Joel

    Hello

    You can switch the VO query editor based on an EO to expert mode. This allows you to change the entire query. Unless you change the use of the attribute, the update through this VO work. Open the VO query and choose the Expert mode option of the query to see what I mean

    Frank

  • I have a problem when going into Firefox, it is password protected and I forgot the password I can't get anywhere.

    When I click on my Firefox I immediately get this message, (image). The problem is that I forgot my password and I can't even click on settings to disable this option, I can't get anywhere.

    You have never installed this extension:

    https://addons.Mozilla.org/firefox/addon/master-password-timeout/
    or is this one:
    https://addons.Mozilla.org/firefox/addon/master-password/
    or this one:
    https://addons.Mozilla.org/firefox/addon/master-password-timeout-UPD/

    In order to bypass the extensions, you can start Firefox in Safe Mode. First of all, make sure that Firefox is completely closed and does not appear in the Manager of tasks (Ctrl + Shift + Esc). In particular, make sure that firefox.exe is no longer running on the processes tab. Or you could do that after restarting Windows.

    Hold down the SHIFT key when you start Firefox.

    A small dialog box should appear. Click on 'Start mode safe' (not update).

    Then you can go to the Add-ons page and remove this extension. Either:

    • CTRL + SHIFT + a
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click Extensions. Find it on the right side, then click on remove. This should take effect when you exit Firefox then start it again normally.

    Success?

  • Bind the Variable Table name in the query of VO

    I have a VO that must have its clause defined dynamically at run time.  I have a string bind variable defined with a default value that is referenced in the query of the VO.  However, JDeveloper allow me to leave the definition of the query of the view object when the from clause is a variable binding, even if the binding variable has the default value.

    For example.

    Select

    « X »

    Of

    : TABLE

    where

    1 = 1

    The variable binding TABLE is defined as a string with a default value of the 'double '.  Did I miss something in the definition of the VO?

    Thank you

    Hello

    I suggest you to dynamically set the query of the view object.  This does not meet your requirements.

    xxVo.setQuery ();

  • How to activate the query suggestions

    How the query suggestions can be enabled in the Firefox address bar?

    You're welcome... good to know you got it working.

  • ID of the query for HP8562A Spectrum Analyzer

    Hello

    I'm just having some difficulty in communicating with my the HP8562A Spectrum Analyzer. I tried to send the query "* IDN?" but he cannot read (probably due to the age of the parser). I look around the Query Analyzer can understand but have had no luck so far. If anyone has had experience with this instrument and communicate with him using GPIB, any help would be greatly appreciated.

    See you soon.

    Try again with ' ID? (no * and no N)

  • The menu selection in multi States of handling state machine

    Hello world

    My application uses States architecture machine, I have to manage the menu selection in two different States, and 2 of them must be managed by the structure of business event.

    The problem is that when I use the structure of the event in the State 1 is also later managed by the case of the event in the 2nd State and it is impossible to manage the selection of menu at the 1st State by the block of 'Selection of the Menu Get' because it's descripton depending on whether the structure of the event is set up to handle the same menu as this block element LabVIEW does not account for this function.

    I would be grateful for any clue.

    Greetings,

    Mariusz

    Thanks, it solved my problem!

    I also had to add the State selector in the Init State. If the reopening, the machine data goes directly to the OpenDataState.

Maybe you are looking for

  • Have formatted the hard drive how do I retriev my FAVORITES

    I format the hard drive from my pc, but I want to keep my favorites. How can I save them in order to keep everything for later use?

  • Broken screen on C660 - 1 7 support

    Hi I broke the screen support on my C660 - 1 7. Does anyone know where can buy a spare part? Will try and stare at me. As is - anyone have an idea of the cost for repair?

  • Gel for laptop

    Hello The last time, I sometimes it all of a sudden my phone freeze. My mouse is not responding that also my laptop keyboard does not respond. When I wait like 2 or 3 minutes, everything works again. But I get no message... so I don't know what is ha

  • Windows live photo gallery screensaver just empty?

    Salvation for a few months now my screensaver windows photo gallery has just been going to blank it used to work and have done so for almost 2 years. I have redownloaded windows live photo gallery and still can't make it work, any help on this would

  • Region with Vista Home DVD code problem

    I have a sony vaio cr290 bought in the United States. I would like to change the dvd region code HT now moved it to the India. its asks me to insert the media to change the region code, I hv tried 4 left. Help, please. I have no Vista support since t