Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle will ignore positions 1000 and after in a string field or expression for sorting using an ORDER BY clause.

Re: Oracle will ignore positions 1000 and after in a string field or expression for sorting using an ORDER BY clause.

From: <Kenneth>
Date: Thu, 13 Jan 2005 16:48:16 GMT
Message-ID: <41e6a2a5.2388015@news.inet.tele.dk>


Hi Roel,

Please pay attention to the NLS_SORT parameter :

SQL> create table test_order_by(num number(10) not null, val varchar2(2000) not null);

SQL> insert into test_order_by values(4, lpad('X', 999, 'X') || 'D' );
SQL> insert into test_order_by values(5, lpad('X', 999, 'X') || 'E' );
SQL> insert into test_order_by values(6, lpad('X', 999, 'X') || 'F' );

SQL> select num,substr(val,1000,1)
  2 from test_order_by
  3 order by val desc;

       NUM S
---------- -

         4 D
         5 E
         6 F

SQL> alter session set nls_sort=binary;

SQL> select num,substr(val,1000,1)
  2 from test_order_by
  3 order by val desc;

       NUM S
---------- -

         6 F
         5 E
         4 D


Received on Thu Jan 13 2005 - 10:48:16 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US