How to load text file into database table
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: [EMAIL PROTECTED] Phone: 202-333- 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: How to load text file into database table
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=0E2CIPD0W 9isbn=0596002106 Dennis Williams DBA Lifetouch, Inc. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -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: [EMAIL PROTECTED] Phone: 202-333- 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: How to load text file into database table
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 [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] 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=0E2CIPD0W 9isbn=0596002106 Dennis Williams DBA Lifetouch, Inc. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -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: [EMAIL PROTECTED] Phone: 202-333- 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: How to load text file into database table
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. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -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 [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] 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 9isbn=0596002106 Dennis Williams DBA Lifetouch, Inc. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -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: [EMAIL PROTECTED] Phone: 202-333- 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from
Re: How to load text file into database table
David, I don't know sqlldr that well, but a possible quick and dirty solution - is to load the text file into a one column oracle table, and then in a subsequent step, use SQL to move the data to the proper columns of the proper Oracle table. The ctl file from the first step would be something like this: 1) LOAD DATA INFILE useraccnt.txt APPEND concatentate 7 INTO TABLE temp (txt char(2000) ) In the second step you could use a bunch of substr and instr to find the column data, or use PL/SQL to loop through the text , or you could use a function in the owa_pattern package Chaim Nguyen, David M [EMAIL PROTECTED]@fatcity.com on 09/20/2002 11:53:29 AM Please respond to [EMAIL PROTECTED] Sent by:[EMAIL PROTECTED] To:Multiple recipients of list ORACLE-L [EMAIL PROTECTED] cc: 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: [EMAIL PROTECTED] Phone: 202-333- 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: How to load text file into database table
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 [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] 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. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -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 [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] 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 9isbn=0596002106 Dennis Williams DBA Lifetouch, Inc. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -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: [EMAIL PROTECTED] Phone: 202-333- 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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