Re: Sorting of a table on create
Date: 1998/01/07
Message-ID: <6914v6$n5u$3_at_svr-c-01.core.theplanet.net>#1/1
Rows are displayed in the order they were inserted until you issue an 'ORDER BY' in you select statement.
Also, watch out for trying to order by a character column, 1111 will come before 20 etc (Unless ref_number is truly alphanumeric). If ref_nbr is numeric make sure you either user 'order by to_number(ref_nbr) or you change the column to a number column (more efficient).
Also be sure to use VARCHAR2 instead of CHAR as Oracle recommends VARCHAR2 (they are also easier to deal with !)
Hopes this helps
Lawrence Simela
MAHALINI CONSULTING LIMITED
Jeff wrote in message <69058p$in2$1_at_usenet52.supernews.com>...
>I am creating a table using the following syntax:
>
>create table customer
> (
> ref_nbr char(13) not null,
> address_type char(2) not null,
> first_nm char(15) null,
> last_nm char(25) null,
> street_addr1 char(30) null,
> street_addr2 char(30) null,
> city_nm char(20) null,
> state_cd char(2) null,
> zip_cd char(5) null,
> social_sec_nbr char(9) null,
> phone_nbr char(10) null,
> buss_phone_nbr char(10) null,
> emp_nm char(30) null,
> constraint pk_refnbr primary key (ref_nbr)
> )
>
>The sytax is correct, but the data is not sorted on the "ref_nbr" column.
>Is there something I am doing wrong? What I am trying to do is create the
>table with a primary key (ref_nbr) sorted on the primary key.
>
>Thanks,
>Jeff
>
>
Received on Wed Jan 07 1998 - 00:00:00 CET