Problem with order by clause

Hai all,

I have problem with order by clause,

My query is

"Select number from table1 order number CSA.

and the output as

1
10
12
13
15
17
19
2
20
21
22
.
........

But if we give the order that it should display below the only good?

1
2
10
12
13
15
17
19
20
21
22 ........

Help me please why it is not displayed as she. and how to make the statement to display as in the second case. Thanks in advance.

Kind regards
Uraja

In your table, the column is VARCHAR2 data type.

It is a string, even if it is to store numeric values, it will get condemn as strings

Try the below

select your_column from table1 order by to_number(your_column) asc 

Published by: JAC on November 19, 2012 16:35

Tags: Database

Similar Questions

  • Problem with REPLACING the clause in Sybase

    I am facing a problem with REPLACING the clause in embedded SQL with a Sybase database.

    My Cold Fusion Server is MX 7.

    The database is the Adaptive Enterprise/12.5.0.3/EBF 10689 IR/P/Sun_svr4/OS Server 5.8/rel12503/1915/64-bit/FBO/Thu 23 Jan 16:05:19 2003

    That is the problem. I have a variable bureau_incode of Cold Fusion, which I use to set the values in my IN clause. When I comment on my request and display this value in the HTML page, bureau_incode has the following value:

    ('TAB', 'OGC', 'BIG', 'OLA', "MDG", "SEO", "OSP", "ANOTHER OWD ',' ', 'PSHSB", "CAT", "WTB")

    My CFQUERY embedded SQL looks like this:

    Quote:
    < name cfquery = "qResults" datasource = "#request.dsn #" >
    Select Name,
    bureau_code,
    Telephone,
    Mobile phone,
    Pager,
    E-mail
    Availability,
    Explanation,
    Password,
    Admin,
    last_login = convert (varchar (20), last_login, 0)
    of PAMS where availability = ' don't
    < #request.seltype # cfif IS NOT "ALL" >
    and bureau_code IN #bureau_incode #.
    < / cfif >
    < / cfquery >
  • Problem with Order by

    Hello everyone

    I am an Oracle Developer, and I have a problem with an order by clause.

    I have a column varchar2 with numeric values and alfanumeric
    For example, I have the following values in the column that I applied the order of: 1,2,3, A, B, C

    When I do next
    Select column_ord From my_table Order by ASC column_ord;
    The result is:
    A, B, C, 1, 2, 3

    With the following:
    Select column_ord From my_table Order by column_ord desc;
    The result is:
    3,2,1, C, B, A

    I Don t udestand this result, because I think that the result should be as follows:
    Select column_ord From my_table Order by ASC column_ord;
    The result is:
    1,2,3, A, B, C


    I work with Oralce 10 g ver: 10.2.0.1. and I tried this in Toad and sql * more

    Appreciate the help, greetings
    Miguel att.

    Published by: Miguel Balderas on 30/03/2011-14:04

    Hi Miguel,.

    Check your session nls_sort setting in this selection: SELECT * FROM v$ nls_parameters;

    For your desirable result, try this: ALTER SESSION SET NLS_SORT = "BINARY";

    Santiago González

  • Problem with order submit data record for Reporting ATG

    Hi, r. j. Nunes

    I am facing problems with the connection to present newspapers for ATG of the report. The logs for RegistrationFileLogger, SiteVisitFileLogger, UserFileLogger, SegmentFileLogger were successfully getting generated but unable to see the logs for OrderFileLogger during shipment of the order.

    I understand that the/atg/reporting/datacollection/trade/SubmitOrderEventListener of the listener must be notified so that the listeners of corresponding data is called in the order:

    SubmitOrderEventListener-> OrderLogEntryQueueSink-> OrderLogEntryGenerator-> OrderFileLogger

    and newspapers would be written.

    But I'm not able to determine which component notifies the SubmitOrderEventListener by submitting an order.


    Is - this SendFulfillmentMessage component? But SendFulfillmentMessage sends the message to the localdms topic: / local/realization/LocalSubmitOrder on the port of OrderSubmitPort which as component SubmitOrderEventListener listen the subject localdms: / local/realization/LocalSubmitOrder on the DEFAULT port?


    Could someone please clarify.

    Thank you

    Saud

    Hello

    Pipelinelink = "sendFulfillmentMessage" name has been commented to our commercepipeline.xml that we did not use OOTB Presse. Once I removed the comment, sent messages and newspapers to submit order got generated.

    Thank you

    Saud

  • Problem with order?

    I had some problems with a po recipes.
    I create a purchase order, but I can´t see it in some organizations. the ship of the organization is the main element of the organization.

    Sorry, I'm not a functional person so I can't offer much help.

    You have consulted the documentation? -http://docs.oracle.com/cd/B53825_08/current/html/doclist.html#Purchasing_p

    If you still have the same problem, then you can save a SR.

    Thank you
    Hussein

  • Need help with order by clause row_number() Fn

    with t as
    (
     select 123 id, 'brwr' lstatus from dual
     union all
     select 123 id, 'ca' lstatus from dual
     union all
     select 123 id, 'fac' lstatus from dual
     union all
     select 345 id, 'ca' lstatus from dual
     union all
     select 345 id, 'brwr' lstatus from dual
     union all
     select 567 id, 'brwr' lstatus from dual
     union all
     select 789 id, 'brwr' lstatus from dual
     union all
     select 1011 id, 'fac' lstatus from dual
    union all
     select 1011 id, 'xyz' lstatus from dual
    )select id,lstatus,row_number() over(partition by id order by lstatus)rw
     from t;
    Desired output
    id           lstatus       rn
    
    123         brwr         3
    123         ca          1
    123         fac         2
    345         ca          1
    345         brwr         2
    567         brwr         1
    789         brwr         1
    1011         fac        1
    1011  xyz         2
    That is, my first priority is to 'ca', then 'College '.

    I am aware that this can be done through the use of CASE within the order by clause
    but could not find the logic of the apt.

    Please help me.

    A solution just for data given to samples...

    with t as
    (
     select 123 id, 'brwr' lstatus from dual
     union all
     select 123 id, 'ca' lstatus from dual
     union all
     select 123 id, 'fac' lstatus from dual
     union all
     select 345 id, 'ca' lstatus from dual
     union all
     select 345 id, 'brwr' lstatus from dual
     union all
     select 567 id, 'brwr' lstatus from dual
     union all
     select 789 id, 'brwr' lstatus from dual
     union all
     select 1011 id, 'fac' lstatus from dual
    union all
     select 1011 id, 'xyz' lstatus from dual
    )select id,lstatus,row_number() over(partition by id order by (case  when lstatus <> 'brwr' THEN UPPER(lstatus) else lstatus end)) rw
     from t;
    

    Basically, it shows how to use the CASE statement. You can change based on your actual data.

    Concerning
    Arun

  • Problem with order of clip

    This is a question and request for suggestions.
    I'm very new to using first Pro CS4 using VideoStudio for a long time. But due to a mutitude of bug and constant crashes, I just let fall on her and made the transition to the first.

    I begin to develop projects of AVCHD clips. My camera creates each scene as a file. With VideoStudio I had to use TSmuxeR to merge them into a single clip, otherwise it would just fall more take hours (literally) to start because she wanted to check each hook. When you have hunderds in a project it is a problem.

    Prime Minister handles this much better doing things in the background, but I had some problems with clips are reordered. Maybe my approach is all wrong and I'm open to suggestions.

    For example, I break the clips in segments that relate to a topic and put in a bin. So, in a project, I would have 700 clips into 10 bins with 50 to 100 clips in each location. And I might have a dozen projects which constitute a 'production '. But when I import clips (IE windows) the last clip always happens to be the first imported. It is a common windows problem which I do not know how to move. In any case, when it gets imported I then rearrange clips. Clips from your device name is a time code date as 20100514082312.mts which is unique and you can order by date very easily, but it is really hard to read.

    The problem that I seem to have if I take a bin (that' it'sbeen sort) and drag it to the timeline, the last clip gets always inserted first. I guess that the Prime Minister is to remember the order that the clips had import and not how I trie in the bins.

    Because I tend to move things around a lot, it is a concern to keep deting first clips and then put on the end of the sequence, etc..

    Is there a way to get around this? As do enforcement in the stick of bins, or order the clips by name in the time line or maybe bring imported in the correct order in the first place?

    Or is the way I'm doing this all wrong. I admit it's hard to give up the way I did things in VideoStudio which could impose some bad habits.

    There is something else you can try - select the media and to automate for the timeline. You can tell it to not add transitions and do not overlap, and there are options to overlay the clips in the order of sorting or the order of selection. Try to select clips in the order of your choice.

    If there is something else in the trash you want, like a sequence, you may need to select all, uncheck what you want and then automate.

  • Cannot wrap a select with order by clause in a file.

    TOGETHER SET TERMOUT OFF FEEDBACK OFF PAGESIZE 0 400 LINESIZE ECHO OFF OFF POSITION

    coil & 1;

    Select "EMPID, EMP_NAME, REGION, FROM, TO, MONTH, ACTIVITY_TYPE, PROJECT_PIN, MILESTONE_NAME, PRACTICE_ID, RESOURCE_CATEGORY, HOURS, COMMENT, percent ALLOCATION, INVOICE_TO, the STATE of the double"

    Union of all the

    select empid,resource_name,region,week_of,(week_of+7),core_month,bill_rate,project_name,project_type,milestone_name,practice_id,resource_category,total_hours_submitted,project_type,"%ALLOCATION",invoice_to,status from master_emp_allocation order by week_of;

    spool off;

    "exit";

    /

    the above block gives result below

    select empid,resource_name,region,week_of,(week_of+7),core_month,bill_rate,project_name,project_type,milestone_name,practice_id,resource_category,total_hours_submitted,project_type,"%ALLOCATION",invoice_to,status from master_emp_allocation order by week_of

    *

    ERROR at line 3:

    ORA-00904: "WEEK_OF": invalid identifier

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

    Without the order by clause it wraps the file passed as an argument.

    check

    Combining the UNION AGENDA and BY

    Columns in the ORDER BY list must be a subset of the columns in the selection list on the left side of the union.

    All the columns in the ORDER BY list should be sorted in ascending order, and they must be a prefix in the order of the columns in the target of the left side of the UNION list.

  • problem with order 40470 themes from adobe for muse

    Hi, I have a problem with a template I received topic of adobe, nr.40470. the problem is that when I preview the page in the browser, the text is on the right side of the chassis. I deleted and reinstalled the model several times but still the same error

    Hi A and C,

    Try to increase the size of the TextBox for a better analysis and share a link to your site.

    Kind regards

    Akshay

  • Help with order by clause

    Hello

    I have a table with the data below, when I run my select with order option gives me
    1 card

    as a first line, but I need it
    12 atm

    as the first line, how this is possible.



    create table test
    (Identification number,
    Val varchar2 (20)
    )


    insert into test values (1, 'Card')
    Insert test values (2, ' map')
    Insert test values (3, ' map')

    Insert test values (4, 'cash')
    Insert test values (5, 'Cash')
    Insert test values (6, 'cash')

    Insert test values (7, "Checque")
    Insert test values (8, "Checque")
    Insert test values (9, "Checque")

    Insert test values (10, 'atm')
    insert into test values (11, 'atm')
    Insert test values (12, 'atm')



    Select * from test
    order by ASC of val

    Or try again with

     select * from test order by upper(val) asc, id desc 
    
  • ORA-00904 ROW_NUMBER, problem with ORDER BY id

    Hello world

    I use Oracle 9i, I use ROW_NUMBER and I got the ORA-00904 because of the ORDER BY identifier.
    SELECT      * 
    FROM      (SELECT c.id_comp, 
              c.nom, 
              c.id_type_comp, 
              c.libelle, 
              c.standard, 
              c.id_comp_std, 
              c.id_comp_grp, 
              (SELECT      t.nom 
              FROM      type_composant t 
              WHERE      t.id_type_comp=c.id_type_comp ) 
              AS      nom_type_comp , 
              (SELECT t.libelle 
              FROM      type_composant t 
              WHERE      t.id_type_comp=c.id_type_comp ) 
              AS      libelletype, 
              (SELECT cc.nom 
              FROM      composant cc 
              WHERE      cc.id_comp=c.id_comp_std ) 
              AS      nom_comp_std, 
              (SELECT ccc.nom 
              FROM      composant ccc 
              WHERE      ccc.id_comp=c.id_comp_grp ) 
              AS      nom_comp_grp, 
              ROW_NUMBER() OVER (ORDER BY nom_type_comp) R 
         FROM composant c) 
    WHERE      nom LIKE '%' 
    AND      R BETWEEN 0 and 200 
    ORDER BY nom_type_comp;
    And here is the error:
     ROW_NUMBER() OVER (ORDER BY nom_type_comp) R FROM composant c)
                                        *
    ERROR at line 25:
    ORA-00904: "NOM_TYPE_COMP": invalid identifier
    Apparently, it takes the pseudonym I use. I tried with the query instead of the alias, and it worked. Is there a way to do it with the alias because I would use a variable with my ORDER BY.

    Any help would be nice!

    Andalusians

    Published by: Guich may 12, 2011 10:40

    You may not use an alias defined on the same query plan.
    The alias must be from a subquery.
    Such as:

    SELECT      *
    FROM      (select my_table.*, ROW_NUMBER() OVER (ORDER BY nom_type_comp) R
             from  (SELECT c.id_comp,
                     c.nom,
                     c.id_type_comp,
                     c.libelle,
                     c.standard,
                     c.id_comp_std,
                     c.id_comp_grp,
                     (SELECT      t.nom
                     FROM      type_composant t
                     WHERE      t.id_type_comp=c.id_type_comp ) AS      nom_type_comp ,
                     (SELECT t.libelle
                     FROM      type_composant t
                     WHERE      t.id_type_comp=c.id_type_comp ) AS      libelletype,
                     (SELECT cc.nom
                     FROM      composant cc
                     WHERE      cc.id_comp=c.id_comp_std ) AS      nom_comp_std,
                     (SELECT ccc.nom
                     FROM      composant ccc
                     WHERE      ccc.id_comp=c.id_comp_grp ) AS      nom_comp_grp
                FROM composant c) my_table)
    WHERE      nom LIKE '%'
    AND      R BETWEEN 0 and 200
    ORDER BY nom_type_comp;
    

    Nicolas.

  • Strange problem with order of cursor on Satellite P100-160

    On my brand new laptop P100-160 with MS Vista Premium, I have an annoying error. Frequently, but without a reason, when I point the cursor on a command and press the touch screen go to the Maximum or to the Minimum size if it's to the Max, but the command is not executed. This happens on all programs, that is to say, words, Excel, games, etc.. I'm away from the United Kingdom and the store where I bought the laptop so resume the shop is not an option.

    Anyone else see this fault or can anyone suggest a solution?

    "It's not a bug, it's a feature!"

    Discover the taskbar when using the touchpad. There is an animated icon beside the clock touchpad. Click twice, and then on the top left device options and on the options again. There, you can spend some time and read about all the flaws of your touchpad - also how you can disable them.

    Have fun.

  • Problem with order by Date

    Apex 3.2

    I have a report based on a collection, but the ranking of start_date and end_date does not work.

    Select

    C002 start_date,

    C003 end_date,

    -start_date to_char (to_date (c002, 'dd.mm.yyyy'), 'dd.mm.yyyy'),

    -End_date to_char (to_date (c003, 'dd.mm.yyyy'), 'dd.mm.yyyy'),

    C004 conversion_factor,

    SI.apskey SMI,

    SI.longdescr Description

    to apex_collections, if udm_si

    where si.siid = c001

    and collection_name = "SMI_INSERT_COL."

    I tried

    C002 start_date,

    C003 end_date

    and put exact in the formatting of column

    I tried

    start_date to_char (to_date (c002, 'dd.mm.yyyy'), 'dd.mm.yyyy'),

    -End_date to_char (to_date (c003, 'dd.mm.yyyy'), 'dd.mm.yyyy'),

    with no formatting of column

    I also tried

    start_date to_char ("c002, ' dd.mm.yyyy")

    but I get an error

    error report:

    ORA-01722: invalid number

    Gus

    Some previous threads please refer to "-" the origin of this. Try to split the "-"s: ".

    ' ': apex_item.display_and_save (2, c002)

  • Problem with a Where Clause in report

    Hi all

    I have a simple report on the EMP table with a form of parameter to select employees of a particular or all departments.
    It works fine if I'm in one or all the departments in the report. The SQL code for the report is the following:

    SELECT
    EMPNO,
    ENAME,
    HIREDATE,
    SAL,
    DEPTNO
    Of
    EMP
    WHERE
    DEPTNO LIKE "%" | : P68_DEPTNO | » %'

    Now, I have added another element of setting labeled "category". If you select the category 'OFFICE', she must return employees of departments 10 and 20, if selected from category 'FIELD', he has to return employees to Department 30 and 40. But if you select the category ALL then he must return the employees of all departments.

    Anyone would be able to advise me on the correct approach to achieve the above?

    You can view the report by clicking on this link: http://apex.oracle.com/pls/otn/f?p=43368:68

    Thank you
    Zahid

    Published by: Zahid Khan on April 15, 2009 16:20

    Something like:

    SELECT
    EMPNO,
    ENAME,
    HIREDATE,
    SAL,
    DEPTNO
    Of
    EMP
    WHERE
    DEPTNO LIKE "%" | : P68_DEPTNO | » %'
    AND
    ((: P68_CATEGORY = 'OFFICE' AND deptno IN (10,20)))
    OR (: P68_CATEGORY = 'FIELD' AND deptno IN (30, 40))
    OR: P68_CATEGORY = "ALL".
    )

    But what happens if the user chooses the category OFFICE and Deptno 30? What needs to happen next? The query above will return any given - no one is in the two 30 and Department 10 or 20!

  • Problem in the SQL because of the order by clause

    Hi all
    I am facing a problem in a sql query. I use Oracle 10 g 2.
    Query is given below:
    SELECT t1.ename
            FROM T1, T2
           WHERE T1.EMPNO = 1234
             AND T1.ACCOUNTNO = T2.ACCOUNTNO
             AND T1.SEQ = T2.SEQ
           ORDER BY T2.SEQ
    The query Plan is:
    .----------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name                 | Rows  | Bytes | Cost (%CPU)| Time     |
     ----------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |                      |     2 |   218 | 11716   (1)| 00:00:41 |
    |*  1 |  TABLE ACCESS BY INDEX ROWID  | T1                   |     1 |    89 |     1   (0)| 00:00:01 |
    |   2 |   NESTED LOOPS                |                      |     2 |   218 | 11716   (1)| 00:00:41 |
    |*  3 |    TABLE ACCESS BY INDEX ROWID| T2                   |     2 |    40 | 11715   (1)| 00:00:41 |
    |   4 |     INDEX FULL SCAN           | PK_T2_SEQ            | 58752 |       |   122   (5)| 00:00:01 |
    |*  5 |    INDEX RANGE SCAN           | FK_ACCOUNTNO         |     3 |       |     0   (0)| 00:00:01 |
     ----------------------------------------------------------------------------------------------------
    Now, I want to reduce the time of this request.

    If I remove order by clause query that the query performance is quite perfect, but with order by clause its take time.

    I already set SORT_AREA_SIZE, but still nothing improves.

    Welcome and thank you for your suggestions.

    Thank you

    Published by: BluShadow on June 23, 2011 07:55
    addition of {noformat}
    {noformat} tags and formatted explain plan to make it readable.  Please see {message:id=9360002} for details on how to post code and data                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    Hey, a quick test, try:

    select ename from (
    SELECT t1.ename, T2.SEQ
    FROM T1, T2
    WHERE T1.EMPNO = 1234
    AND T1.ACCOUNTNO = T2.ACCOUNTNO
    AND T1.SEQ = T2.SEQ
    and rownum > 0)
    ORDER BY SEQ
    

    Amiel Davis

Maybe you are looking for

  • Why can I not see my stereo in AirPlay after I upgraded 10.0.2?

    After that I updated to IOS 10.0.2 that I can no longer see my stereo running on airport express.  The old Airplay has been renamed AirPlay Mirroring and shows only my Apple TV.  I'm looking for my stereo.  Is there a switch somewhere, or did Apple j

  • You want to change disk g 128 to 512. Is this possible?

    I'm running out of hard disk space on my MacBook Pro 128 GB. Can upgrade you hard drive 512

  • How can I make my backflip JUST vibrate when I get a text?

    Hey guys I just got the backflip and I'm in love, but it's my first phone andrioid so im alll not really sure on how I get on apps and I can already do, I knew that I needed a soft to turn my phone to silent to normal and whatnot , but do I need an a

  • VPN gateway to gateway RV0XX

    Greetings, I have a RV082 and a RV042. I was able to successfully establish a vpn connection from gateway to gateway between the two and I can remotely manage each router through the VPN connection, but I am unable to computers ping from one side of

  • How can I capture CCDR call id in a CRS Script?

    I'm typing ID CCDR appeal so that it can be passed along on the CAD Office. In this way the agent can then enter it as part of the call within the app notes of third party clients. This will help the client identify which record CCDR was for what cal