Sort problem: ORDER BY the numbers all first instead of characters first

Hello

I need help with the problem of the following sort:

create table test01 (sorting_column varchar2 (30));

insert into values test01 ('Test123');
insert into values test01 ("Test987");
insert into values test01 ("123Test");
insert into values test01 ("987Test");
insert into test01 values (string 'test');

Select sorting_column from test01 arrested by sorting_column;

SORTING_COLUMN
------------------------------
Test string
Test123
Test987
123Test
987Test

This is not the order that I need. I really wish it were (numbers before characters):

123Test
987Test
Test123
Test987
Test string

Can anyone help?

Thanks in advance,
Marc
SELECT sorting_column
FROM test01
ORDER BY nlssort(sorting_column, 'NLS_SORT=BINARY')
;

Can be set at the level of the session as well:

ALTER SESSION SET NLS_SORT = BINARY;

Published by: odie_63 on June 20, 2011 17:45

Tags: Database

Similar Questions

  • Sort of a system of numbering both Alpha and numeric characters

    I have a database of about 370 products we manufacture. The numbering system is 3 digit design followed by the character alpha code 1-6 letters. For example:

    014A6LP (for our company, that means that number 14, while the A6 refers to a particular size and the LP of the design is the type of product).

    014FAP (same design, different product type)

    014A2LPBX (again, same design, different product type)

    I tried to sort my table such as numbers and text. I tried to add custom formats that include leading zeros. I even tried to let go the zeros (even if I really need them). I don't like to work.

    The result I want is this:

    001A6LP

    002A6LP

    002FAP

    003A2FPBX

    003A6LP

    003NBF

    etc, etc.

    what I get instead is this: as you can see it my list starts with 012 instead of 001. As it continues, 100 comes before 010, etc.

    I look forward to your ideas and help.

    Thank you

    Josh

    Hi Josh,.

    You can paste your table in a post (as opposed to a screenshot)?  In this way we can try the actual values you have.

    SG

  • Calculate values in order by the numbers

    I have a table of values where the formulas are all values of "HAZARD". I want to recalculate these values in a command and not automatically. In windows this fact using the formula and calc keys - how can I do this in numbers?

    Format a cell as a checkbox, let's say cell A1

    Then use the formula

    = if ($A$ 1, Alea, 0, 100), Alea, 0, 100))

  • Photos App: sort out the problem with the album "all photos".

    photos App: problem of sorting with the album "all photos".

    I activated my iCloud library and as little shared albums.

    In 'Moments' pictures are sorted right (as), but when I go to Album > all photos,.

    so, I see a lot of fotos mixed up. In the option, I see that "all photos" are sorted by date 'added' that still does not make sense...

    It's annoying because when I access photos (iOS) to some 3rd - party - app, it does not show 'moments' but albums like "all pictures" that is not sorted...

    Thanks for the help in advance

    The albums predefined in the Photos on a Mac are sorted differently, in order to have different ways to access your photos.

    • The sight of Photos with Moments and Collections is sorted by the date of Capture.
    • The album 'All the Photos' is sorted by the date that you imported photos, not dates, that the photos were taken.

    Albums that you set yourself can be sorted by title or date of capture. So you can set your own album "my photo all ' as a smart album (file > new Smart Album) by using a rule 'Date's after... ', for example:

    This smart album will contain took all the pictures taken since January 1, 1000 and can by sorted according to the date of capture.

  • How to change the sort order of the items sought for the last element of this research first. I DON'T want to say the order search engines, but the existing research by arrow down

    I want to be able to change the sort order of the items, I already looked in the search box. I want to be able to hit the arrow key down and see my previous searches in order of last search showing the first. For the moment, I don't know how it is sorting and it is very annoying to have to re - enter a query that I typed 5 minutes earlier, but because I typed in another 10 since it's lost somewhere in the list. Is it possible, I Googled, but did not find the topic anywhere. Just to clarify, I DON'T mean of the order of the search engines (which is what appears in google), I mean that the text typed into which has been registered in the drop-down list.

    Thank you

    'Form filling' uses a "frecency" algorithm, frequency + recency, similar to the list of AutoComplete address bar.

    I found an extension that seems relevant, but critics are old, so I'm not sure it's still working: Searchbar Autocomplete Order.

    But... is the AutoComplete does not? I expect that typing a few characters of the previous query would be to filter the list so that you can easily select? Or is the problem that the list does not remember quite who looking for?

  • Sort order of the desktop icon

    I noticed that the sort order for the icons on my desktop is a little strange.  When I sort by alphabetically by name, they go through the alphabet once, then again in alphabetical order.  In other words, there are two sets of icons sorted in alphabetical order.  I had this problem on my previous PC, which ran from Windows XP.  Now that I have a new PC running Vista Home Premium, the problem persists.  Can I have some kind of installation or configuration problem?

    I searched the Knowledge Base Microsoft and the Internet, for this problem, but found nothing.

    Thank you

    El_Abuelo

    What determines what type of folder is assigned a specific icon?  (The shortcut properties seem to indicate that property may have something to do with it.)

    It is normally determined by the installer that created the shortcut in the first place.  Most software publishers are lazy and will place a single shortcut in % PUBLIC%\Desktop, which will appear on the desktop for everyone if you have multiple users.  Unfortunately, if a user removes the shortcut it will disappear from all the world office too.  The solution is to manually copy in all the individual desktop folder and then delete the original.

    All of the shortcuts that you you do it manually (for example, by right - dragging a file to the desktop) will appear in your folder %USERPROFILE%\Desktop and therefore appear to you and not to other users.

    Of course, if you are the only user on this computer, none of the foregoing is of no interest to you.  In this case, if you want everything sorted alphabetically, choose one of the two locations and manually move everything else.  Given that %PUBLIC%\Desktop is most software installation uses, it will probably be the best choice, by remembering that if you manually create the shortcuts, you must manually move them yourself or they will be out of use again.

    Another thing to watch is installers of software that prompts you to install for 'all users' or 'me' (or words to that effect).  The option all users will put the shortcut to the Public folder. the just me option will use your user profile folder.

  • The order of the points in a sort pathPoints array

    Well, why would I do that? Well, I have areaText the rectangles that have been created by various means, and index 0 is sometimes high on the left, other times the bottom right. I need to do a lot of resizing, alignment, spacing, sizing. To describe the movement of the top left point of each (or anywhere else), I'm trying to clean up the sequence of points in each table pathPoints objects in order to move the pathPoint [0] .anchor for each rectangle and make sure that the upper left corner moves, not another random corner.

    Then, test only one script, and I came up with the following (don't laugh about how I called the table), which works very well in extendScript:

    var testArray = new Array;

    testArray.push ({xVal: 5,:0}) yVal;})

    testArray.push ({xVal: 0, yVal:-2});

    testArray.push ({xVal: 5, yVal:-2});

    testArray.push ({xVal: 0, yVal:0});})

    function primarySort() { testArray.sort (function (a, b) {return b.yVal - a.yVal});}   }

    function secondarySort() {}

    reorganize the first pair of xVal-based points

    If (Number(testArray[0].xVal) > Number(testArray[1].xVal)) {}

    Sensors = testArray [1];

    testArray.splice (1,1);

    testArray.unshift (moveMe) ;}

    reorganize the second pair of points based on xVal

    If (Number(testArray[2].xVal) < Number(testArray[3].xVal)) {}

    Sensors = testArray [2];

    testArray.splice (2.1);

    testArray.push (moveMe) ;}    }

    function printArray() {}

    for (i = 0; i < testArray.length; i ++) {}

    var writeMe is testArray [i].xVal.toString () + ', ' + testArray [i].yVal.toString ();.

    $.writeln (writeMe);  }}


    primarySort();

    printArray();

    $.writeln ('... ») ;

    secondarySort();

    printArray();

    So then I tried to do the same thing for Illustrator:

    var ObjArr = app.activeDocument.textFrames;

    var objPoints = new Array;

    for (i = 0; i < objArray.length; i ++) {}

    var pathObj = .textPath ObjArr [i];

    objPoints = pathObj.pathPoints;

    XYpairSort() ;}

    function XYpairSort() {}

    writes the current sequence of anchor pathPoint y coordinate x in the console

    for (i = 0; i < objPoints.length; i ++) {}

    writeMe var = objPoints [i] .anchor [0] m:System.NET.SocketAddress.ToString () + ', ' + objPoints [i] .anchor [1] m:System.NET.SocketAddress.ToString () + "," + i;

    $.writeln (writeMe) ;}

    Sort the four points at the top and at the bottom of the pairs

    objPoints.sort (function (a, b) {return b.anchor [1]-a.anchor [1]});

    reorganize the first pair of xVal-based points

    If (Number(objPoints[0].anchor[0]) > Number(objPoints[1].anchor[0])) {}

    Sensors = objPoints [1];

    objPoints.splice (1,1);

    objPoints.unshift (moveMe) ;}

    reorganize the second pair of points based on xVal

    If (Number(objPoints[2].anchor[0]) < Number(objPoints[3].anchor[0])) {}

    Sensors = objPoints [2];

    objPoints.splice (2.1);

    objPoints.push (moveMe) ;}

    writing the new sequence of pathPoint anchor y coordinate x in the console

    for (i = 0; i < objPoints.length; i ++) {}

    writeMe var = objPoints [i] .anchor [0] m:System.NET.SocketAddress.ToString () + ', ' + objPoints [i] .anchor [1] m:System.NET.SocketAddress.ToString () + "," + i;

    $.writeln (writeMe) ;}

    }

    Who raises an error "objPoints.sort is not a function".

    Unlike the single version JS, my script HERE trying to sort all the points of all of the textAreas, which I will fix shortly so it sorts the 4 points for each object. The problem is that the script is not sorting points, but providing a helpful error instead.

    Any ideas? Research on the Internet for this error does not explain why it happens, just in other ways to do the kinds.

    Well, if you did this time to the discussion, the approach I took is completely unnecessary.

    You see, I knew .top, .the .width and .height rectangles properties, and if you changed the width of a textFrame, he would scale the text that it contains:

    var obj = app.activeDocument.textFrames [0] / / guess that's narrower than the 2 inches

    obj. Width = 144; will scale the width of the block and its content also.

    Thus, to avoid the problem of scaling that I had to make sure that the textPaths of what I had selected was the same index order for I can enter each item individually and always take the same point for each textFrame. I was changing the height and width of each textFrame by assigning new XY coordinates at each angle of the trajectory. Good to know how to do this, but not necessary, because the attributes .top, .the, .width and .height are available for the textPath object.

    What I do not know (and do now), is that you can change the path without scaling the content:

    var obj = app.activeDocument.textFrames [0] / / guess that's narrower than the 2 inches

    var objPath = obj.textPath;

    objPath.width = 144;  is not at the scale of the text inside the frame.

  • problem with changing the order of tab on tab control

    Hello

    I am aware that the same question has been asked over three years - but I can't yet find the problem in what I'm doing...

    Description: I have two controls tab, A tab with three tab and tab B with two controls on a Panel. For the following discussion, tab B is of no interest. Each tab control has several numerical indicators, of type integer and double. Now, I want to add a fourth tab control to A tab. This method works.

    Following and problematic stage, in the Publisher of the IUR I select the new tab (most right) and move two positions to the left. It's still ok until I try to display a numeric value of order of tab 3 (the new tab control is left to it). I get an error in calls to SetCtrlAttribute, complain about an invalid control ID... However, I didn't touch any control over the tabs, or add a new control. In addition, I did not touch the generated include file... Visual inspection did not show any changes in the include file (the new tab control is listed only when certain controls are added)

    Posting numbers on the first/far left tab control work only on 3 and 4 which are suitable for the new (and still empty) new tab will generate this error. Adding a control to the new label does not change the bahavior.

    Help is appreciated!

    Wolfgang

    Wolfgang,

    When you get the handle for your tab using GetPanelHandleFromTabPage:

    GetPanelHandleFromTabPage (MainPanelHandle, PANEL_TAB, 0, & TabHandle);

    the third parameter is an index for the specific tab you want to address.  If you change the order of the tabs, you can change the index, too.  For example, assume that you have a digital control on the third tab from left to right.  You want to assign some value, so this, you:

    GetPanelHandleFromTabPage (MainPanelHandle, PANEL_TAB, 2, & TabHandle);

    SetCtrlVal (TabHandle, TAB_numMyNumeric, 1);

    Now, you add a new tab to the left of the tab with the digital contorl.  The new tab is now index 2 and the original tab is index 3.  When you call:

    GetPanelHandleFromTabPage (MainPanelHandle, PANEL_TAB, 2, & TabHandle);

    you get the handle to the new tab.  There is a control with the same ID as TAB_numMyNumeric, so that you get a runtime error.

    Personally, I like to use an enumeration to my tabs so I can keep the lines:

    enum {MY_FIRST_TAB, MY_SECOND_TAB, MY_THIRD_TAB,...};

    So if I redesign the tabs or add a new one I just re - order enums and everything works fine.  Also, I used the same names in my constants of tab, to help keep things straight:

    GetPanelHandleFromTabPage (MainPanelHandle, PANEL_FIRST_TAB, MY_FIRST_TAB, & TabHandle);

    Tony G.

  • Photo library - sort order of the change for "organizing a month."

    Is it possible to change the sort order when viewing the pictures library, arranged by month? When I put the menu "arrange by" to "month" in the library pane, files in my library of images are correctly grouped by month, but in reverse chronological order. The most recent month is displayed first. For example, September 2010, August 2010, July 2010,..., etc. I would like for this switch to chronological order: January 2010, February 2010, March 2010, etc. The option "sort by" is grayed out in the menu. I can value the sort order ascending or descending if the library is organized by day, but not when arranged by month. Thank you.

    Hello

    I searched all the documentation and it doesn't seem to be any way to reverse this order, when the month is checked?

    Kind regards

    Thank you for using Windows 7

    Ronnie Vernon MVP
  • When I burn CD for my use on the computer, sometimes the order of the songs are returned, starting with the last song first.

    * Original title: Windows Media player

    When I burn CD for my use on the computer, sometimes the order of the songs are returned, starting with the last song first.  This is the CD, or I do something wrong?  This isn't an ongoing problem... most of the time it's ok.  Can I change the order manually. If Yes, where and how.

    Thank you

    Lee

    Lee - there are a number of possibilities. First of all, it depends whether you burn audio disks or data - if they are audio discs, you can check and rearrange the order of songs in the burn list - if necessary - before you start burning. If you drag multiple files to the burn list quite often the last track you clicked on will go upward, so I wonder if it is what can happen. Back with a little more detail if I not quite correctly interpreted the problem. Best regards, Ric.

  • List of files in numerical order after the first two digits

    I have scanned documents on a usb key & saved as pdf files using a 8-digit date.  When I go to open the files, they are only in the order for the 2 first digits.  How can I get adobe to put in order using all 8 digits so that they are listed in chronological order, including the day and year?

    Adobe not in numeric order question.png

    The operating system will not sort by date like this. If you look at, it IS the 'digitally' sort 'dates' are in numerical order from the smallest to the largest.
    What I'm doing to sort by date is to use this format "YYYYMMDD".

  • Sort order of the photos in albums to iCloud

    When I add the creation of an album using Photos shared on iCloud, pictures are sorted by date, oldest first, any order, they were initially classified as.  Is there a way to change that to preserve the original order of the photos, or at the very least, use manually in the order, I want to use?

    Shared albums are sorted by the order, they are added to the album if you wish in a precise order add them manually one by one.

  • I have a number of accounts (left), I would like to change the order in which they are displayed, THE who is first and who is the last.

    In the left column of the program is a list of all the e-mail addresses that Thunderbird checks. I want to change the order of the list of e-mail addresses. Some addresses are more important to me than others. I would like than to be at the top of the list. How can I move them in the order I want?
    Thank you

    Install this add-on.
    https://addons.Mozilla.org/en-us/Thunderbird/addon/manually-sort-folders/

  • How can I change the sort order in the Photos?

    How can I change the sort order in the Photos? I would like to have more recent photos at the top of the screen instead of at the bottom.

    The view of Photos with moments and collections will be sorted always growing by date, also the album «All the Photos»

    But you can sort any other album descending by date.  Create your own album custom as smart album 'My Pictures' and the descending sort.

    File > new Smart Album

    and use the rules:

    CTRL-click the smart album in the sidebar and in this way it as you want:

    These sorting options available in Photos on MacOS X 10.11. El Capitan, but not in Yosemite.

  • How to make a text field to accept a capital letter has or a number in the position of the first character and only the numbers after that?

    Hi all

    We have a text field in one of our screen in our mobile app. Currently the user can enter alpha numeric characters in this text field.

    It is now that this field should accept a capital letter A or a number in the position of the first character and only the numbers after that.

    Could someone let us know how to do this?

    Thank you.

    Or, how about the substitution of this abstract method in textFilter?

    public boolean validate(character char,
                            AbstractString text
    int position)

Maybe you are looking for