Home » SQL & PL/SQL » SQL & PL/SQL » Display Record in Specific Order  () 1 Vote
Display Record in Specific Order [message #331747] Sat, 05 July 2008 03:40 Go to next message
M.Shakeel Azeem
Messages: 226
Registered: September 2006
Senior Member
Dear All,

I run the query to display product_name in order
product_name column datatype is varchar2(25)

SELECT product_name
FROM tab1
order by product_name asc

PRODUCT_NAME
---------------------------
TELENOR TOPUP Rs 50000
TELENOR TOPUP Rs 20000
TELENOR TOPUP Rs 10000

but i want to display in the following

PRODUCT_NAME
---------------------------
TELENOR TOPUP Rs 10000
TELENOR TOPUP Rs 20000
TELENOR TOPUP Rs 50000


how can we do it?
Please suggest
thanx in advance
Re: Display Record in Specific Order [message #331750 is a reply to message #331747] Sat, 05 July 2008 03:53 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Sorry if this sounds harsh, but I don't believe you, unless you kept some info from us.

To prove that what you claim is true, please execute the following in sqlplus and copy-paste THE ENTIRE session.
create table my_tab(my_product_name varchar2(25));
insert into my_tab values ('TELENOR TOPUP Rs 20000');
insert into my_tab values ('TELENOR TOPUP Rs 50000');
insert into my_tab values ('TELENOR TOPUP Rs 10000');
select *
from   my_tab
order  by my_product_name;


My prove:
SQL> create table my_tab(my_product_name varchar2(25));

Table created.

SQL> insert into my_tab values ('TELENOR TOPUP Rs 20000');

1 row created.

SQL> insert into my_tab values ('TELENOR TOPUP Rs 50000');

1 row created.

SQL> insert into my_tab values ('TELENOR TOPUP Rs 10000');

1 row created.

SQL> select *
  2  from   my_tab
  3  order  by my_product_name;

MY_PRODUCT_NAME
-------------------------
TELENOR TOPUP Rs 10000
TELENOR TOPUP Rs 20000
TELENOR TOPUP Rs 50000
Re: Display Record in Specific Order [message #331757 is a reply to message #331750] Sat, 05 July 2008 04:47 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
It's possible that your strings contain some non-printable characters.


Post the results of this:
SELECT product_name, dump(product_name)
FROM tab1
order by product_name asc


Ross Leishman
Re: Display Record in Specific Order [message #332080 is a reply to message #331747] Mon, 07 July 2008 08:06 Go to previous message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
As Spock once said, to paraphrase, when the logical does not work, do the illogical.

How about using DESC, even though it goes against all logic?
Previous Topic: Commit data in several databases
Next Topic: Flashback Transaction Query and date datatypes
Goto Forum:
  


Current Time: Tue Dec 06 12:33:47 CST 2016

Total time taken to generate the page: 0.10467 seconds