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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Newbie sqlload question

Re: Newbie sqlload question

From: Sten E. Vesterli <sev_at_tpi.dk>
Date: 1996/11/23
Message-ID: <3296E2E3.20BA@tpi.dk>#1/1

Atif Ahmad Khan wrote:
>
> I have a test table with one row in it that has 2 columns.
>
> Part_number varchar (12) primary key;
> Price real ;
>
> Part_number Price
> ----------- -----
> 123456 100
>
> imported from a text file catalog.txt:
> 123456 ,100
>
> using control file :
> LOAD
> INFILE 'catalog.txt'
> INTO TABLE catalog_db
> FIELDS TERMINATED BY ','
> ( Part_Number,
> Price char terminated by whitespace )
>
> Now when I do :
>
> select * from catalog_db where part_number='123456';
>
> It returns nothing. Apparently it loaded all he whitespaces also and
> considers that part of the number and therefore says that
> '123456' <> '123456 '
>
> My question is how can I tell sqlload to ignore trailing whitespaces ?
> I cannot give it a fixed position (from/until) for this field as the
> part number could be fewer or more characters han 6.
>
> Thanks very much. Any help will be greatly appreciated.
>
> Atif Khan
> aak2_at_ra.msstate.edu

You could just let the loader load it and then remove the trailing spaces with
UPDATE catalog_db SET Part_Number = RTRIM(Part_Number, ' ');

(reproducing RTRIM syntax from memory - please check yourself)

Good Luck

Sten Vesterli
sev_at_comsprog.dk Received on Sat Nov 23 1996 - 00:00:00 CST

Original text of this message

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