Yes
Main Topics
Browse All TopicsI have a txt file with more than 1.5 lakh Pipe(|) delimited records. I want to load those records into a Oracle table using Stored Procedure. If file does not exist it should come out of the Procedure. Also I need to delete the previous day records before inserting new records. I am using Oracle 10g. Can you please let me know how can I achieve this?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Use SQL*Loader or External tables to do this. External table will allow you to do this directly in PL/SQL, without having to invoke SQL*Loader. The external table will behave similar to a normal table, but the underlying data is really stored in a text file. There is a ton of info on the Internet with External table examples.
Here is a good example with a comma delimited file.
http://www.orafaq.com/node
External tables and PL/SQL is the best approach for this type of ETL process, imo. The stored procedure will perform the following steps:
1. attempt to select from external table (linked to text file)
2. if error, file doesn't exist
3. if no error, file exists so proceed to next step
4. truncate current data table
5. insert into current data table, from external table
Please note that "lakh" is a Hindi word, not an English word, so very few English speakers outside of India or Pakistan understand what that word means. The common English word for a very large number is: million. One million is equal to 10 lakh.
I agree with the other recommendations. You should *NOT* use stored procedures to create tables. That is not what Oracle PL\SQL is optimized for. And yes, if the table already exists, you can use UTL_FILE to read a text file line-by-line and insert each record into the table, but a much more efficient approach is to use either SQL*Loader or an "external table" to make the data from the file available to your Oracle database.
Business Accounts
Answer for Membership
by: sdstuberPosted on 2009-09-24 at 08:03:42ID: 25414078
lakh?