Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help on expression compare in Oracle
"Roby" <roby81it_at_hotmail.com> wrote in message
news:78d0e70f.0301200528.46056881_at_posting.google.com...
> And I have this strange situation:
>
> SQL> select * from test where chiave < '0100';
>
> no rows selected
>
> SQL> select * from test where chiave > '0100';
>
> CHIAVE DESCR
> -------------------- ------------------------------
> A1 desc1
> A2 desc2
> A3 desc3
> 0101 desc5
> 0200 desc6
>
> If I decide to order by CHIAVE, why Oracle considers 'A1' lesser than
'0100',
> but when I select values where chiave < '0100', it return no rows ???
You don't actually post the statement with an ORDER BY in it and so not ordering your resultset, you need an order by clause if you wish to order by something.Example shown below.
SQL> create table orderbyeg(id varchar2(4),description varchar2(50));
Table created.
SQL> insert into orderbyeg values('A1','A1 PRODUCTS');
1 row created.
SQL> INSERT INTO ORDERBYEG VALUES ('0101','A2 PRODUCTS'); 1 row created.
SQL> INSERT INTO ORDERBYEG VALUES ('C3','AARDVARKS ''R'' US'); 1 row created.
SQL> COMMIT; Commit complete.
SQL> SELECT * FROM ORDERBYEG WHERE ID > '01'); SELECT * FROM ORDERBYEG WHERE ID > '01')
*ERROR at line 1:
SQL> ED
Wrote file afiedt.buf
1* SELECT * FROM ORDERBYEG WHERE ID > '01' SQL> / ID DESCRIPTION
---- --------------------------------------------------A1 A1 PRODUCTS
---- --------------------------------------------------0101 A2 PRODUCTS
-- Niall Litchfield Oracle DBA Audit Commission UK ***************************************** Please include version and platform and SQL where applicable It makes life easier and increases the likelihood of a good answer ******************************************Received on Mon Jan 20 2003 - 07:54:59 CST
![]() |
![]() |