Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading a text file...automation

Status
Not open for further replies.

mike777

Programmer
Jun 3, 2000
387
0
0
US
Hello.
Can anyone tell me the best way to, in a procedure, load a text file to a table? I was looking at the UTL_FILE utility, and then I realized (finally, like after 2 hrs!) that this applied only to files that exist in the Oracle server. Then I was looking at the TEXT_IO utility, but only found one paragraph (actually, like two sentences) on how to use it. Is TEXT_IO the correct way to do it? I need it to be a procedure, so I can call it from VB, where the user can just click a button to load a file.
Any help you can provide will be very much appreciated.
Many thanks.
-Mike
 
The utl_file utility can be used to load files that are on any network computer - you have to set the file path parameter like this:
utl_file.fopen('\\pathToTheFile', 'myfile.txt', 'r');

This will open the file for read access. You can then read the file line by line using the get_line function.
 
Text_io package is Oracle Developer built-in, so it can be called from Forms/Reports only. To perform file operations from VB you should create your own VB procedure. Regards, Dima
 
Hi,
The best solution for your requirement is to write a stored procedure wherein you can use UTL_FILE and use your files and then call this stored procedure from your VB.

Thanks & Regards,
DoubleH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top