Order by lower()

I have table T defined below. I sort data with "order by lower(t.VAL)". My question is:
Is there any certain rule how "equal for such order by" records are ordered?
Is it maybe always so, that records with 'a' comes always firstly, and 'A' after those?
Is it maybe always so that records with 'a' are ordered by table primary key?
Or is it so that records are ordered randomly always?
Or are they always ordered in certain way, then define this rule/way.
with T as
(select 3 ID, 'a' VAL from dual union all
select 2 ID, 'A' VAL from dual union all
select 1 ID, 'a' VAL from dual)
select * from T
order by lower(t.VAL);
3     a
1     a
2     A
*/Edited by: CharlesRoos on Apr 16, 2010 4:42 AM
Edited by: CharlesRoos on Apr 16, 2010 4:42 AM

Hi,
CharlesRoos wrote:
I have table T defined below. I sort data with "order by lower(t.VAL)". My question is:
Is there any certain rule how "equal for such order by" records are ordered?
Is it maybe always so, that records with 'a' comes always firstly, and 'A' after those?
Is it maybe always so that records with 'a' are ordered by table primary key?
Or is it so that records are ordered randomly always?
Or are they always ordered in certain way, then define this rule/way.
with T as
(select 3 ID, 'a' VAL from dual union all
select 2 ID, 'A' VAL from dual union all
select 1 ID, 'a' VAL from dual)
select * from T
order by lower(t.VAL);
3     a
1     a
2     A
When you say "ORDER BY x", and x is not unique, there is no guarantee that the rows with the same x will be in any particular order. You may get a certain set of results, then, if you run the exact same query again, without changing the table, get different results.
The order isn't really random, but it is arbitrary. In practice, especially with small tables, you will tend to get the same results, so you might think there is some rule, but the only rule is that no order is guaranteed.
If you want rows in a certain order, add more ORDER BY expressions to break the ties.
For example:
ORDER BY  LOWER (val)          -- 'A' and 'a' together, before 'B' and 'b'
,       val          DESC     -- 'a' before 'A'
,       id

Similar Messages

  • Rounding of material qty in sales order to lower  decimal value of 0.001

    Hi
    The issue is with a sles order.When the user creates an order of a material of quantity for ex: 7434.73 kg the ssytem automatically rounds the quantity to 7434.729kg.There is no rounding profile mainatined in the material master and the the unit KG has been define for decimal 3 units (in the SPRO setting).
    One more observation is when the smae material is ordered for quanity 1000.73,2000.73,3000.73 or 4000.73 this rounding does not happen.But when the quantity is 5000.73 this issue occurs.
    Any idea as to what is the probabe cause?
    Any OSS notes on  this issue?
    Thanks,
    Satyajit Mohanty

    Hi Satya,
    First check with Material master -
    >basic data -
    >Additional Data------->check any  AlternativeUnit of measure is maintained
    Second check with Condition Types(V/06)----
    > Scales -
    >check with Scale formulas and unit of measure
    and in "control data2"----
    > check with quantity conversion
    and finally with Condition records(VK12)----
    >for that materials .........how scales are mainatined
    Hope this finding will help you.
    Regards,
    Seegal

  • [JPA/TOPLINK] is the function "lower" supported in "order by" clause?

    In EJB-QL
    I can use lower() or upper() in where clause.
    But there is always a parse exception thrown when i tried to use it in main clause or order by clause.
    works:
    select s from Student s where lower(s.name) like 'm%'
    exception thrown:
    select s from Student s where s.name like 'm%' order by lower(s.name)
    OR --------------
    Why i am asking this is that the resultset returned from database is not alphabetical sorted but ascii sorted, which means any characters with upper case is always prior to the ones with lower case.
    If EJB-QL doesn't support using lower() in order by clause, do I have any other options to avoid this problem?
    BTW, it is the Oracle 10g we are using as DB
    many thanks,
    Xuphey
    Edited by: Xuphey on Nov 29, 2007 1:33 AM

    If you want to do this, you'd have to use dynamic SQL (execute immediate or DBMS_SQL). For the easier 'execute immediate' approach, you'd do something like
    create or replace someProc( someArg varchar2 )
    as
      strSQL varchar2(4000)
    begin
      strSQL := <<string containing your SQL statement up to the order by clause>>
      strSQL := strSQL || 'ORDER BY ' || someArg
      execute immediate strSQL;
    endJustin

  • Design a 1st order Butterwort​h low pass filter

    Hey there... Really hope that u guys can guide me to solve these questions.. =)
    Design a first order Butterworth low pass filter with cut-off frequency
    fo = 20 kHz and the gain K = 1. You will need to simulate the circuit
    using Multisim and shows that the circuit meet the required
    specification.
    i)Show all calculations steps and assumption made in your circuit design.
    (DONE!)
    ii)Show the circuit schematic with all the resistor and capacitor values labelled.(attachment)
    iii)Perform frequency response analysis on the circuit and obtain the
    bode diagram. The bode diagram should show the voltage gain (Vout /
    Vin) in dB vs the signal frequency (0 to 100 MHz). Does the -3dB
    cut-off frequency match the desired cut-off frequency fo = 20 kHz ?
    Explain. From the graph, estimate the roll-off rate. (attachment)
    I inserted my schematics and graph.. am i right?
    Attachments:
    Question 2a.zip ‏146 KB

    Just an update for the community, in version 11 and 12 of Multisim, there are some circuit wizards available which can make designing some basic circuits easier. To access the filter wizard, go to Tools -> Circuit Wizard -> Filter Wizard. You can put in the parameters and Multisim will automatically generate the filter for you.
    Hope this helps.
    Regards,
    Tayyab R,
    National Instruments.

  • How to find out manual deletion of planned orders in APO.

    Planned orders are created on multiple bom levels when we call CTP from GATP for sales orders. For particular sales order there is no planned ordere at lower level. Dependent requirement is there which is uncovered.
    I want to find  somebody has deleted this planned order manually in apo. How to find out the same?
    Regards,
    Santosh

    Hi Santosh,
    If you suspect that the planned order was created but later on deleted manually, there is a cross check you can do to determine that.
    In case of MATP, System uses the higher level Planned Order number to create the Dependent Demand at the lower level and only when this dependent demand is covered by a planned order it assigns the corresponding planned order number to it. So if you see the dependent demand number with same  number as the higher level planned order for which it was created, you can be sure that a planned order was not created to cover the dependent demand that you see uncovered.
    If the dependant demand number is not same as the planned order at higher level, then the planned order to cover the dependent demand was deleted.
    I guess CTP also works the same way. If you're unsure about this, test it out.
    Hope it helps.
    Regards,
    Mohan

  • Item configuration not possible in Sales Order

    Dear friends,
    Our requirement is as follows:
    I have created a configuration material and assigned MTS strategy (10) in MRP3 view.
    As I am carrying out cost estimate run and SAP does not allow to calculate std cost for config material, I assigned same material in MRP3 view as variant. This allows std cost estimate run.
    Now while creating sales order, system is showing configuration screen in display mode.I am not able to input characteristics in Sales order.
    Is there a way out??
    I have changed the requirement class relevant to strategy 10 and put configuration allowed tick.
    Additional Information:
    1. If I don't assign the material in MRP3 view, sals order config is allowed. But then I could not run the cost estimate.
    2. If I assign account assignment category M or E in requirement class, sales order configuration is possible. But then sales order becomes MTO, which is not accepted.
    Thanks in Advance,
    Avinash

    usuaully, config material, business follows MTO strategy,
    Good Question. Let me explain why MTS with configuration.
    We always try to produce high quality product - Char Fe content should be 90%. Because this product will always have higher demand and higher price.
    But as ours is a process industry we end up producing FE content 80 to 90 % (about 40 % of our material is between 80 to 85 %Fe content). FG is stored in batches according to Fe content.
    Now I take orders from customers for the low Fe content produced with reduced rate. The negotiated Fe content I want sales team to put in Sales order configuration. That is the only reason I want the chars editable in SO.
    Even customer asked for low Fe content, I can supply high Fe content and take additional amount according to contract. This is how the industry works. Basically customers are putting orders for low FE, as high Fe material is not available in the market.
    As I will always try to produce high quality product, the scenario can not be MTO. But I want to mention customer demanded Fe content in Sales order so that I can supply him right batch from yard.
    Regards,
    Avinash

  • Does low-res videos/movies look bad on the Retina display? (compared to a full hd display)

    I'll be watching a lot of movies/series on the MBP Retina i've ordered, will low-res/480p look slightly worse than it would on a full hd display, or will it look horrible?
    Thanks!

    What is a "low-res" video? It will look as good as the "low-res" is. If the video is 100px x 100px it will display 100px x 100px unless you stretch or otherwise manipulate it.
    If a "low-res" video is an old 1930's grainy video it will look like a 1930's grainy video.
    Maybe I did not understand your question.

  • Sorting Column - Case Insensitive but Lower should be first

    Hi all,
    Lets assume we have am EMployee table :
    create table Emp (Empname varchar2(20));
    It has following records :
    Insert into EMP (EMPNAME) values ('A');
    Insert into EMP (EMPNAME) values ('a');
    Insert into EMP (EMPNAME) values ('b');
    Insert into EMP (EMPNAME) values ('c');
    Insert into EMP (EMPNAME) values ('D');
    Insert into EMP (EMPNAME) values ('e');
    Insert into EMP (EMPNAME) values ('E');
    Insert into EMP (EMPNAME) values ('F');
    i.e
    Empname
    A
    a
    b
    c
    D
    e
    E
    F
    I need output as below : ( Sort by Ascending, case insensitive meaning I don't want all Capital first and then Lower letters. The results should be in alphabetical order it shouldn't matter whether its capital or small. More important is that small letter should come first then the Capital letter). Is this possible?.
    Empname
    a
    A
    b
    c
    D
    e
    E
    F
    Select * from emp order by Lower(empname) Asc;
    Doesn't do the job, because 'A' comes before 'a'.
    Regards,
    Bhaskar

    select empname from emp order by upper(empname),ascii(empname) desc;
    EMPNAME
    a
    A
    b
    c
    D
    e
    E
    F
    Cheers,
    Manik.

  • JPQL How to ORDER BY UPPER ?

    hi,
    how can i do an order by upper/lower in JPQL? i am getting the below exception while trying to use this:
    EJBException:javax.ejb.EJBException: EJB Exception: ; nested exceptio
    n is:
    <openjpa-1.1.0-r422266:657916 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Encountered "lower" at character 73, but expecte
    d: ["AVG", "COUNT", "MAX", "MIN", "SUM", <IDENTIFIER>].
    i am using the following namedquery
    @NamedQuery(name="getProductbyType",query="SELECT t FROM ProductBean t WHERE t.productType = :productType order by lower(t.title)"),
    thanks
    Edited by: badguitarist on Feb 26, 2009 1:51 AM

    What is your target database????
    badguitarist wrote:
    also am still getting the same error when i use ORDER BY ABS(t.title)ABS() is used for Integer Data type fields... and here i can understand that title field is a Varchar and it will
    definitely fail.
    I am able to execute the queries successfully in DB2 db.
    I have even tried UPPER() in Order By clause and i got the result accordingly.......
    Edited by: MPA2009 on Mar 2, 2009 3:04 AM

  • Case Insensitve Ordering

    My CFQUERY is working fine, and has for years. I am ordering
    my lastname. Just recently a client joined the list with a last
    name that starts with a lower case letter. As many of you know,
    lowercase appears at the end in a database sort. This really screws
    up my reports.
    I tried using ORDER BY lower(lastName) and ORDER BY
    UCASE(lastName) but neither of those solutions work. They throw
    errors. What am I missing here? What is the best way to deal with
    this?

    I see. I was adding lower(lastname) to my order by statement.
    Using the alias solved a couple of problems. Thanks Dan.

  • HOW TO LOWER THE NUMBER OF KBPS

    I WANT TO SAVE UP SPCE IN MY iPod
    HOW SHOULD I OPERATE IN ORDER TO LOWER THE NUMBER OF KBPS IN AN AUDIO FILE????

    As Gerry says, you can't change your purchased songs without first burning them to CD and re-importing them at a lower bitrate so I would forget about them. For everything else you first need to change your import settings to the format and bitrate you want for your iTunes files. After that everything you import will use that setting. If you like, once you've done that you can convert your existing songs and the conversion will use the import settings you chose.
    1 Open iTunes
    2 Go to iTunes>Preferences>Advanced>Importing
    3 Choose the format you want from the menu alongside Import Using, for instance AAC Encoder
    4 Choose Custom from the Setting menu
    5 In the dialog box that now appears, choose the Stereo Bit Rate you want from the list
    6 Leave the remaining two boxes at auto and click OK
    7 Click OK in the Advanced box to complete the setup
    If you do convert your existing songs however you will end up with duplicates which you'll have to delete from the libray. To do this just go to the Library and sort your selection in "Bit Rate" order, that will allow you to quickly
    identify the orginals. If Bit rate isn't a visible column in your Library then go to Edit>View Option and choose it from the list that appears.

  • Bessel low pass filter and sampling frequency

    I have a 20 kHz sine wave signal, use the Bessel LowPass filter.
    The input parameters for the filter are as followings: sampling freq: 204800, Order: 8, low cutoff freq: 30000.
    The filtered X has a much lower amplitudue compared to to the input signal.
    If I change the sampling frequency to 80000, it seems the filtered X is better.
    Can you please explain the behavior of the filter?

    Thank you for the reply!
    I attached a test vi, which generates a sine wave and calculate its RMS (basic DC/RMS). The sine wave is then passed to a low pass filter, a new RMS is calculated from the filtered signal.
    Test case 1:
    Frequency = 10 kHz, Amplitude = 4, Sampling Info: Fs = 80 k, #s = 1000; Low pass cutoff frequency = 30 k; Filter sampling frequency = 80k.
    The signal RMS  = 2.8284; Filtered signal RMS = 2.71.
    Test case 2:
    Same setup as case 1, change the Filter sampling frequency to 204800.
    The signal RMS  = 2.8284; Filtered signal RMS = 2.4688.
    Test case 3:
    Frequency = 20 kHz, Amplitude = 4, Sampling Info: Fs = 80 k, #s = 8000; Low pass cutoff frequency = 30 k; Filter sampling frequency = 80k.
    The signal RMS  = 2.8284; Filtered signal RMS = 2.21.
    Test case 4:
    same setup as case 3, change the sampling frequency to 204800.
    The signal RMS  = 2.8284; Filtered signal RMS = 1.5369
    Can you please why increasing the sampling frequency will get lower RMS value?
    Thanks.  
    Attachments:
    LowPass Test-1.vi ‏34 KB

  • Field Order/Dominance question

    I've been noticing that spots I've produced that air on my local cable network appear to be having problems with jerky movement of elements created in Motion. I thought that maybe the field order was set wrong on my Motion projects. (I should add that I'm doing "the big no-no" by only monitoring these on my computer and not on a TV monitor. I know, I'll have to remedy that someday.) Anyway, I'm using the "NTSC Broadcast SD" preset and that means field order is lower/even. I'm definitely rendering these out with field rendering on (Apple ProRes, btw) as I can see the interlace combing when viewing the output file.
    I thought I'd try an experiment by creating a Motion project that would expose interlacing problems in the worst way and then render it out of Motion three ways: lower, upper and none. I then encoded these to mpeg-2 using Squeeze and burned them to a DVD (in DVDSP) to view on my consumer DVD player and SD television. (Remember, that's the only way I can view them played back interlaced...) To my surprise both the upper and lower movies looked terrible and the one rendered with no field dominance looked the best.
    What gives? Any ideas? Does this seem right?
    Thanks!
    --Kurt Cowling

    Wow Iain, you know waaaay more about this than I do. In fact, I asked a question in the iDVD area of this board many moons ago regarding whether or not there was some sort of metadata or tag that let iDVD know if the incoming file was interlaced or progressive and the response was basically "I don't know for sure, but I don't think so".
    Anyway, I can confirm what you say regarding the output of ProRes files. The content is interlaced, but when clicking the deinterlace button in the advanced area of QuickTime player nothing happens.
    I tried as you suggested and opened the "Advanced..." area of the output settings in Motion and found that interlace was indeed not checked in the ProRes settings. When I output a file after checking that box I can also confirm that the deinterlace button in QT player did actually deinterlace the display of the file.
    I normally output my Motion projects in several layers and bring them back into FCP (as rendered video, not Motion files) to composite them with the underlying camera footage. (Makes later changes and updates easier to deal with for my workflow.) I then export the composite out of FCP as uncompressed SD and then proceed to encode for FTP delivery from there (usually H.264). I opened a recent uncompressed file that was output from FCP and found that it suffered from the same problem, namely that the file was not tagged as interlaced, even though the content was interlaced.
    I then opened one of the H.264 files that was encoded from the uncompressed master. Same issue again.
    The one thing I haven't tried (yet) is outputting my test project from Motion as described in my first post (but with the files tagged correctly this time!) and see if the DVD that gets burned plays correctly. I will try this in the next day or two.
    I don't know what happens to my files after I FTP them to the cable provider, but I assume they must transcode them from H.264 into their system. If the files aren't tagged as interlaced then their system is probably treating them incorrectly, as well.
    This brings me to the final question(s) that may solve all of this for me:
    Is there a way to change just the metadata/tag in an existing QuickTime file (so that it is tagged correctly as interlaced) without having to re-render from the beginning? Also, It appears that FCP may suffer from the same issue since it obviously uses QT to export, just like Motion. If I correctly tag a file rendered from Motion and then import it into FCP and FCP doesn't then pass the correct tag on output to uncompressed I still have the same problem. Or, if FCP tags the uncompressed file correctly, but QT doesn't pass this along to the H.264, I'm still screwed. Hence, my question at the top of this paragraph! I think I really only need the last file I handle before FTPing to have the correct tag, since the content has been fine all along.
    Thanks so much Iain for looking into this! I would never have found this on my own. I'm not exactly sure if this is a bug or just a bad implementation, but this seems like a bad oversight for sure and not something that could be figured out from reading the manual.
    --Kurt
    p.s. I will try some more experimenting with this and hopefully can come back and marked this thread as "question answered" since a workaround seems doable. Iain, would you be willing to submit this to Apple as a bug report? You seem to have a much better handle on this than I do.

  • Consumption for make to order

    Hi Experts,
    I have a requirement ...." When I run MRP for the sale order for the finished product , system is creating palnning praposals for FERT material BOM and next level BOM'S also. But my requirement is  If stocks are there , system has to consume the stocks first of all RM's and HALB materials" .
    I have maintained Collective requirements in MRP4 view for all materials , but still system is not considering my stocks .
    Plz suggest me how to achieve this .
    Thanks & regards
    Prabhakar

    Hi,
    MRP will create dependent requirements for Raw Materials and HALB materials based on the FERT requirement. If system does not find available inventory for Raw Materials and HALB to meet the demand it will create the planning proposal (Planned Order) for lower level elements also.
    Go to MD04 screen for the HALB materials and check what is the current situation (stocks...dependent reservations etc...)
    Try and revert back.
    Regards,
    Swapnil

  • Case insensitive ordering in an interactive report

    How would I alter the interactive report so that the inbuilt ordering will order alphabetically, regardless of case?
    the default behaviour seems to be that it orders using lower a-z and then upper a-z.

    a long time ago (...) I created a solution where I modified the column headers. If you hover over a column header with the mouse, you see that it is a generated link. I also created a hidden column, but modified the header of the visible link so that it refers to the hidden column.
    Not too sure if it's easy to als make it sort asc/desc alternating, but you should be able to do at least an asc sorting with not much trouble.

Maybe you are looking for