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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to load text file into database table

RE: How to load text file into database table

From: Viral Desai <viral303_at_hotmail.com>
Date: Fri, 20 Sep 2002 12:39:49 -0800
Message-ID: <F001.004D591B.20020920123949@fatcity.com>


Dennis,

Absolutely, I agree. Perl is very handy and easy to learn..., You could use awk also on unix, pretty nifty stuff...

To answer to your situation where the REASON line could be more than one/two/three or n lines- Yes, you could use CONTINUEIF.

It provides a comparison operators (= and !=) in each physical line to look for certain tokens in certain positions. You can look/peek at current, previous or next physical lines before deciding break of lof=gical record, while loading ....Pretty cool stuff.

I think you can load any free-format as long as you can define logical record by some rule. Again, not to discount your suggestion, there are many ways, I just thought passing my idea.

Cheers,
Viral.

>From: DENNIS WILLIAMS <DWILLIAMS_at_LIFETOUCH.COM>
>Reply-To: ORACLE-L_at_fatcity.com
>To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
>Subject: RE: How to load text file into database table
>Date: Fri, 20 Sep 2002 12:05:43 -0800
>
>Viral - I'm glad that someone a lot more familiar than I with SQL*Loader
>replied, and hopefully that will handle David's problem. I'm just curious
>about one thing, having encountered this sort of thing before. Can
>SQL*Loader handle the situation where some lines may not be present? For
>example, suppose the REASON line is sometimes two or three lines. When I've
>had situations like this, I've often seen a variable number of lines. That
>is why I suggested Perl, which can easily handle this sort of thing. Of
>course, Perl is so handy that I think every DBA should learn it, for tasks
>just like this.
>

>Dennis Williams
>DBA
>Lifetouch, Inc.
>dwilliams_at_lifetouch.com <mailto:dwilliams_at_lifetouch.com>
>
>
>-----Original Message-----
>Sent: Friday, September 20, 2002 2:44 PM
>To: Multiple recipients of list ORACLE-L
>
>
>Oracle sql*loader has many many features...at two of them are applicable in
>your specific case.
>
>You could use CONCATENATE or CONTINUEIF clauses of control file. These
>clauses help you wherever you have multiple physical records form one
>logical record.
>
>Cheers
>Viral Desai.
>
>
>
> >From: DENNIS WILLIAMS <DWILLIAMS_at_LIFETOUCH.COM>
> >Reply-To: ORACLE-L_at_fatcity.com
> >To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
> >Subject: RE: How to load text file into database table
> >Date: Fri, 20 Sep 2002 08:53:34 -0800
> >
> >David - If the file is in just the format you show, my first impulse
>would
> >be to use the perl script language to get it into a form that sqlldr
>could
> >easily read. Perl is available on all platforms, including Windows. If
>you
> >get ambitious, Perl can even directly insert the values into Oracle.
>Jared
> >Still, the manager of this list has just published a book on that aspect.
> >
> >http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?userid=0E2CIPD0
>W
> >9&isbn=0596002106
> >
> > 
> >Dennis Williams
> >DBA
> >Lifetouch, Inc.
> >dwilliams_at_lifetouch.com <mailto:dwilliams_at_lifetouch.com>
> >
> >
> >-----Original Message-----
> >Sent: Friday, September 20, 2002 10:54 AM
> >To: Multiple recipients of list ORACLE-L
> >
> >
> >I have a text file and need to load it into database table using sqlldr
> >utility. Is there a way to load a text file? I know how to load csv file
> >but not text file.
> >
> >*** Below is text file format.
> >
> >Date: Wed Aug 29 10:43:53 CDT 2001
> >Name: Paris By Night
> >Email: xyz_at_testing.com
> >Phone: 202-333-4444
> >Location: Washington, DC
> >Equipment needing to access: EMS, , , , ,
> >Reason: Not working
> >
> >I want to above data into useraccount table which has following columns.
> >
> >date
> >username
> >email
> >phone
> >location
> >equipment
> >reason
> >
> >Thanks in advance,
> >David
> >
> >--
> >Please see the official ORACLE-L FAQ: http://www.orafaq.com
> >--
> >Author: Nguyen, David M
> > INET: david.m.nguyen_at_xo.com
> >
> >Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> >San Diego, California -- Mailing list and web hosting services
> >---------------------------------------------------------------------
> >To REMOVE yourself from this mailing list, send an E-Mail message
> >to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> >the message BODY, include a line containing: UNSUB ORACLE-L
> >(or the name of mailing list you want to be removed from). You may
> >also send the HELP command for other information (like subscribing).
> >--
> >Please see the official ORACLE-L FAQ: http://www.orafaq.com
> >--
> >Author: DENNIS WILLIAMS
> > INET: DWILLIAMS_at_LIFETOUCH.COM
> >
> >Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> >San Diego, California -- Mailing list and web hosting services
> >---------------------------------------------------------------------
> >To REMOVE yourself from this mailing list, send an E-Mail message
> >to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> >the message BODY, include a line containing: UNSUB ORACLE-L
> >(or the name of mailing list you want to be removed from). You may
> >also send the HELP command for other information (like subscribing).
>
>
>
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: Viral Desai
> INET: viral303_at_hotmail.com
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: DENNIS WILLIAMS
> INET: DWILLIAMS_at_LIFETOUCH.COM
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).



Send and receive Hotmail on your mobile device: http://mobile.msn.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Viral Desai
  INET: viral303_at_hotmail.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Sep 20 2002 - 15:39:49 CDT

Original text of this message

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