... Is sorting on a given value possible in oracle?

Hello
I have a table that contains a column titled 'level' (values possible sont0, 1, 2, 3, 4, 5) and a second column, 'createTime' (date of entry is created).
I want to display the sorted lines in this way:
-First level = 5
-Then the other levels (in any order, but ordered by crateTime).
-For 2 categories, I want the results sorted by crateTime.

In mysql, I could do:
SELECT createTime level, FROM table order by desc level = 5, createTime asc;

In Oracle "level = 5 order" is not accepted."
Is there a way to do this?

Thank you.

That's what you're looking for:

SELECT * FROM my_table
ORDER BY (CASE WHEN level = 5 THEN 0 ELSE 1 END), createtime
/

Published by: AP on October 11, 2010 05:07

Tags: Database

Similar Questions

  • The thickness of particle detection and eradication of these particles with thickniss less than a given value

    In my project after comparison of model or get I the image with defects.

    I defects (particles) are relevant with a thickness greater than a given value.

    I have tried a few methods, particle analysis, read a few articles in this forum... But I can't find any real solution to my problem.

    I need suggestions how to on this subject.

    Thanks in advance.

    Devrim

    Is there a way to filter the particles from erosion.  If the particle is still after N erosions, it is preserved.  Otherwise, it is removed.  The function is IMAQ RemoveParticle.

    Bruce

  • When possible in Oracle Forms to insert a second line based on 1st row, so why not in the ADF?

    Mr President

    When possible in Oracle Forms to insert a second line based on 1st row, so why not in the ADF?

    The user just enter data in the Module of sales in one line of a Bill as below

    and it is displayed in two rows in financial Module.like below how to proceed in the ADF.

    You can see that invoice line contains the sales tax and the gross sales amounts, then it is posted to the financial Module above two lines.

    How to make ADF

    Respect of

    What I realized, this is:

    -You have a table in you screen.

    -You call CreateInsert 2 times to create 2 rows at the same time.

    -You will enter value in a specific column (c1) line1

    Looking for the value that you entered in row1 can be completely copied in the same column (c1), but in line2. is this correct?

    If so try to do the following:

    1. in the table inputText (c1) column set autoSubmit = true and setValueChangeListener to a method in backbean

    
           
    
    

    2. in the inputTextValueChangeListener method to write this code

      public void inputTextValueChangeListener(ValueChangeEvent valueChangeEvent)
      {
        DCIteratorBinding tableIter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("tableIteratorName");// write table iterator name from pageDef.
        for (int i = 0; i < tableIter.getViewObject().getEstimatedRowCount(); i++)
        {
          ViewRowImpl myRow = (ViewRowImpl) tableIter.getRowAtRangeIndex(i);
          EntityImpl entityImpl = myRow.getEntity(0);
          if (EntityImpl.STATUS_NEW == entityImpl.getEntityState())
          {
            System.out.println("New row found");
            myRow.setAttribute("AttributeName", valueChangeEvent.getNewValue());// write attribute name
          }
        }
      }
    

    3 - Add inputText id in the partialTrigger table

    
    

    4 - pageDef. Set of table iterator rangeSize = "-1".

  • CTE - possible in Oracle?

    I picked up this clever code of a SQL Server forum.

    Is this possible in Oracle?

    with data as (
     
    select * from ( values
      
    (1,1,'one'),
      
    (2,1,'two'),
      
    (3,1,'three'),
      
    (5,1,'five'),
      
    (6,1,'six')
     
    ) data(PKID, FKID, MYTEXT)
    )
    select lhs.*, sequence = count(*)
    from data lhs
    left join data rhs on rhs.FKID = lhs.FKID
     
    and rhs.PKID <= lhs.PKID
    group by
      lhs
    .PKID,
      lhs
    .FKID,
      lhs
    .MYTEXT

    ;

    Hello

    The common Table Expressions (aka "CTE", "Subquery factoring" or "WITH the terms") work in Oracle 9 and more.

    There other things in the query that you posted this will not work in Oracle.  For an equivalent of the Oracle, you may need to SELECT the table double literals.  There is an example of this in the FAQ forum:

    https://community.Oracle.com/message/9362002#9362002

    under the terms of paragraph 7.

  • Is it possible create Oracle RAC on NFS datastore?

    Hello

    Is it possible create Oracle RAC on NFS datastore?   With the VMFS data store, we use VMDK files as the Oracle RAC shared virtual disks with the Comptrollership and multi-writer SCSI Paravirtual, what about the NFS datastore? is the controller SCSI Paravirtual and writer multi function supported on the NFS datastore?

    Unless I'm missing something, this is not supported on NFS.

  • How to find this value in the oracle database to find out the table

    Hi expert,

    I know there is a value in the oracle database, please show me how to find this value in the oracle database to find out the table that contains this value.

    Thank you very much

    918440 wrote:
    Hi expert,

    I know there is a value in the oracle database, please show me how to find this value in the oracle database to find out the table that contains this value.

    Thank you very much

    Go to the online documentation and discover the data dictionary. You may be interested in reading about ALL_TAB_COLUMNS, but you will need to know what you want until you can query the view to find information

  • Is it possible on ORACLE TEXT to convert. RTF in XML or PDF?

    Is it possible on ORACLE TEXT to convert. RTF in XML or PDF?
    If its possible, can you show some examples please. I look everywhere and can not find anything.

    ctx_doc.policy_filter only supports text and html.

    Thank you.

    N ° text of Oracle does not provide this functionality.

  • GPO sorting FlexField array elements is possible?

    Hi all.

    I have a table, this table contains more than one column, one of them is FlexField, which contain 7 columns.  Case in common, I put the column real SortAllowed property and it will work, but it does not work with FlexField. How can I fix this (if itn is possible)?

    I don't have a lot of time.

    Nice day.http://www.otmfaq.com/forums/images/smilies/tongue.png

    p.s Flex field has property Type: Descriprive.

    Hi Alex,

    Because Oracle does not sort on DFF, you can check if you need the FDF itself values (in function of the importance is the requirement of sorting). A solution could be to capture the columns in FACT as of the independent columns of the database in the custom table and allow to sort. But this way you'd lose the flexitbities provided by DFF.

    Concerning

  • to sort alphabetically by field value

    There are 3 fields named TextField1, TextField2 and TextField3. If the user enters 'B' into TextField1, TextField2 "A" and "D" in TextField3, when this file is closed the value will be rearranged in alphabetical order. For example, "A" in TextField1, 'B' to the TextField2, "D' TextField3.

    Is it possible to do? If so how I can get it?

    In addition, there is another field named "summarry. Any value will be popuated in alphabetical order.

    In addition, the 1st initial of the value will be deemed to be alphabetical order by order.

    Hello

    Take a look at the post of John Brinkman: http://blogs.adobe.com/formfeed/2009/05/sort_subforms.html.

    Here, it has a function that you can use to sort the subforms/table rows. I used it here, and it works well. You may want to call the docReady event.

    Good luck

    Niall

  • restrict the application of hierarchy based on a given value at the leaf node level

    Is it possible to restrict a query of the hierarchy based on a test given at the leaf node level?

    For example, in the data presented below, I like to shoot the entire hierarchy for terminal nodes that have 'John' in the criteria:

    Parent value criteria
    Z
    A Z
    B HAS
    C B John
    D B Smith
    E Z
    F E
    John F G
    H F Neal
    I have F John

    Filertering on John I want to return together to resemble the following prints:
    A
    B
    C
    F
    G
    I have

    I tried the following, but it only gives me the nodes:
    SELECT
    LPAD (' ', (LEVEL) * 3,'.) ') || t.Valeur
    OF tbl_test t
    WHERE t.criteria = "John".
    START WITH t.valeur = "Z".
    CONNECT BY PRIOR t.valeur = t.parent;

    Rule return form the above query:
    C
    G
    I have

    Any help is greatly appreciated.

    It is possible, but not conventional =)

    Sys_connect_by_path allows you to concatenate the path and another request of the hierarchy of dividing a value generated in the rows.

    with t as (
    select 'Z' as  Val , null as  Par, null as  Criteria from dual union all
    select 'A' as  Val , 'Z' as  Par, null as  Criteria from dual union all
    select 'B' as  Val , 'A' as  Par, null as  Criteria from dual union all
    select 'C' as  Val , 'B' as  Par, 'John' as  Criteria from dual union all
    select 'D' as  Val , 'B' as  Par, 'Smith' as  Criteria from dual union all
    select 'E' as  Val , 'Z' as  Par, null as  Criteria from dual union all
    select 'F' as  Val , 'E' as  Par, null as  Criteria from dual union all
    select 'G' as  Val , 'F' as  Par, 'John' as  Criteria from dual union all
    select 'H' as  Val , 'F' as  Par, 'Neal' as  Criteria from dual union all
    select 'I' as  Val , 'F' as  Par, 'John' as  Criteria from dual
    )
    select distinct regexp_substr(path, '[^,]+', 1, level) as val
    from (  SELECT  sys_connect_by_path(val,',') as path , rownum as row_id
              FROM   t
            WHERE t.criteria = 'John'
            START WITH t.val = 'Z'
            CONNECT BY t.par = PRIOR t.val
         )
    connect by nocycle regexp_substr(path, '[^,]+', 1, level) is not null
    and prior row_id= row_id
    and prior dbms_random.value is not null
    
  • Determination of the moment at a given value of channel

    I have a simple script question DIAdem.  I have a dataset using two channels: 1) and 2) Switch_1.  'Switch_1' has Boolean values (0 or 1... or turn off).  In the file, the "Switch_1" varies from 0 to 1 several times.  I want to wrtie a script to determine the period of time which 'Switch_1' is equal to 1.  Can someone help me to do this?

    Hi Dan,.

    Sorry for the delay.  Put the two enclosed scripts in the same folder somewhere, and then run the 'County State Duration.VBS' in the Panel SCRIPT DIAdem.  It will pop up a dialog file - select the DDHN file that you sent me.  It loads the file, calculates the delta time, divides the values of the State of the switch in a group '0' and '1', then calculates the sum of all time to delta for each group.  You can find the result in the "Description" of each group and property 'Description' of each channel "time".

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • CursorX alignment with a superficial given value

    Thanks in advance for any help:

    I use DIAdem 2011 and am looking for the Script function that will give me a value (time cursorX) when I locate a measured surface location. The problem I have is I can place the superficial on a situation of tension on a curve, but the cursorX does not follow (almost as if it were in "Free cursor" mode).

    I'm looking to measure delta time from two places different from voltage on a signal using the cursorX and cursory.

    I use the 'Frame', function "Curve slider" slider.

    Any ideas?

    Thank you

    SJD

    Hi, SJD,.

    I think it is a mistake to send only a single value to a channel.  If you want to view this set of 4 scalars, I recommend sending to the legend of the VIEW or DISPLAY text or a floating dialog box.  I enclose the text box option SEE below.  The 'slope Info Start.VBS view' could be added on your existing script - it sets up the 'View slope Info Event.VBS' script to execute every time the cursor changes.  Then the layout 'View slope Info.TDV' shows the information in the upper text display area.  I had to press to the text box to refresh the strength, but I didn't think it was usually necessary.  You will need to modify the TDV I sent to show your Television '"command entry' ' or some XY trace you want to measure the slope of.

    Ask if you have any additional questions,

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Interactive report using month Picker Plugin-date maximum one month given values of display column?

    create table test

    (

    The user ID number,

    created_on date

    )

    Insert into test values(1,'03/11/2014');

    Insert into test values(1,'03/27/2014');

    Insert into test values(1,'04/14/2014');

    Insert into test values(1,'02/20/2015');

    Insert into test values(1,'02/27/2015');

    Insert into test values(2,'03/10/2014');

    Insert into test values(2,'03/19/2014');

    Using http://www.Oracle-and-apex.com/plugin-month-picker/ in report interactive apex:-

    I want the answer which is the maximum date of the month and year

    for a specific user for the month selected

    For example if I chose March 2014

    as input is 03-2014

    so it should display

    username created_on

    1 27/03/2014

    2 03/19/2014

    Help, please

    oracle 11 g r2 database version

    Apex Oracle version 4.2.4

    ReemaPuri wrote:

    create table test

    (

    The user ID number,

    created_on date

    )

    Insert into test values(1,'03/11/2014');

    Insert into test values(1,'03/27/2014');

    Insert into test values(1,'04/14/2014');

    Insert into test values(1,'02/20/2015');

    Insert into test values(1,'02/27/2015');

    Insert into test values(2,'03/10/2014');

    Insert into test values(2,'03/19/2014');

    Http://www.oracle-and-apex.com/plugin-month-picker/ in report using interactive apex: -.

    I want the answer which is the maximum date of the month and year

    for a specific user for the month selected

    For example if I chose March 2014

    as input is 03-2014

    so it should display

    username created_on

    1 27/03/2014

    2 03/19/2014

    Help, please

    oracle 11 g r2 database version

    Apex Oracle version 4.2.4

    Based on the information provided:

    select
        userid
      , max(created_on)
    from
        test
    where
        created_on >= to_date(:p1_month_picker, 'mm.yyyy')
    and created_on < add_months(to_date(:p1_month_picker, 'mm.yyyy'), 1)
    group by
        userid
    

    However, I suspect that the information provided is not the full story...

  • Presentation: default value (possible error) based on the input argument at the pre-trial stage partially the value

    Orchestrator 5.5.1 using 1617127. Same results with different JDK of Oracle 1.7.0_55, 1.7.0_60, 1.7.0_65 and 1.8.0_11.

    Create a workflow with two entrances, two channel. Adjust the presentation by adding a new step and place the second entry in the new stage. Add a property to a default value for the second input parameter. Set default OGNL and specify the first parameter of default entry.

    Save and close. Run the workflow. Enter several characters for the first input parameter, and then click Next. The default value displayed for the second input parameter is usually the first character or a few initial characters of the first input parameter.

    Behavior seems to be related to how fast the first input parameter is typed. Typing slow gives only the first default character for the second input parameter. Fast typing usually results in several characters. Paste the value complete for the first parameter usually gives full value as the default value.

    I want to derive from the default values for the following input parameters from of the entries in a previous step. I use an action to create a more interesting default value that above, but I still need the total value for the first parameter to build my default.

    Is there something that I am missing, or is this a bug?

    Thank you

    Bob W.

    Hi Bob,

    This behavior is by design - default values are evaluated only once. What you want is achievable via another property called "data binding".

    I hope this helps.

  • Make editable field when the checkbox is enabled, otherwise given value read-only

    I try to make a PDF form to fill out, and a document existing, using Acrobat Pro, which does the following:

    Form is designed to allow customer agrees to buy a personalized work of art.

    The work has a base price, ArtworkPrice. (The ArtworkPrice field is editable)

    The customer can choose to include a picture frame. (AddFrame 'Yes' box.)

    Choose 'Yes' to add a frame, adds an amount.  (The FramePrice field is editable only if AddFrame checkbox is enabled)

    Otherwise, leaving unchecked AddFrame fills the FramePrice field with a value of 0.00.

    The TotalPrice is calculated as the sum of the fields FramePrice and the ArtworkPrice. (The TotalPrice field is read-only)

    So... this part of the form looks essentially this:

    AddFrame? [] Yes

    ArtworkPrice _ $ + FramePrice $_ = TotalPrice $_

    The FramePrice field must be 0.00 (and not editable) at all times unless the AddFrame checkbox is selected.

    How can I do this?

    Add this code to the MouseUp of AddFrame event:

    If (this.getField("AddFrame").value == "Off") {}

    this.getField("FramePrice").value = 0;

    this.getField("FramePrice").readonly = true;

    } else {}

    this.getField("FramePrice").value = "";

    this.getField("FramePrice").readonly = false;

    }

Maybe you are looking for

  • Proximity sensor does not

    I own a motorola defy... a few days ago, my proximity sensor no longer works... let explain me the situation: every time I have place a call, the screen empties automatically until I place it on my ear and I have to use the power button to turn it on

  • error code (80070718)

    just replaced a power supply after several months down... now try to update... only able to install some updates after rebooting several times... always get this error code-80070718.

  • HP OfficeJet Pro 8620: HP OfficeJet Pro 8620 Scan to Email function

    HP OfficeJet Pro 8620 is a great value for all the features it offers. "Scan to Email" was one of the reasons why I bought this printer. Even if I can do this fucntion work with my gmail and iCloud emails, I feel very uncomfortable in the provision o

  • Keys 'F' G72

    Hello I use applications that have very convenient function keys.  How can I disable the features HP F keys (for example, a dark screen on the "F2") on my Win7 G72 laptop? SA. DSF

  • An assortment of BSOD

    Hello.  I'm having a little trouble with my computer (Vista Home Basic 32 bit on a Hewlett-Packard) and would ask for help, please.  I don't know what the problem is, and my computer broke down several times in the last days.  I have the info in the