Home » SQL & PL/SQL » SQL & PL/SQL » Read file on local machine (Oracle 11)
Read file on local machine [message #558946] Wed, 27 June 2012 12:15 Go to next message
Charly2012
Messages: 2
Registered: June 2012
Location: bcn
Junior Member
Hello

A basic question:
From a script how I can read a local file (where I have the sql client)?

I explain more:
I have an Oracle database on a server, and I connect from another machine with SQL Developer.
I want to read a text file on my local machine ( where I run my script) to use the data in the script.
I never want to read or write on the server.

Reading on internet i read about UTF_FILE package
But what is not clear to me is, this is on the server or client ?
Also some people says UTF_FILE can work both on client side and server side. If this is correct, how do you distinguish?

Also I read about package text_io, but I think it is only for forms.

Anybody can answer me this ?

thanks
( sorry for my english )
Re: Read file on local machine [message #558947 is a reply to message #558946] Wed, 27 June 2012 12:19 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/

>Reading on internet i read about UTF_FILE package
>But what is not clear to me is, this is on the server or client ?
DB Server side ONLY!

[Updated on: Wed, 27 June 2012 12:19]

Report message to a moderator

Re: Read file on local machine [message #558966 is a reply to message #558947] Wed, 27 June 2012 14:02 Go to previous messageGo to next message
Littlefoot
Messages: 21826
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If possible, load the file into a table with SQL*Loader (as it is capable of handling files on a client). Then do whatever you want with contents of that table.
Re: Read file on local machine [message #559043 is a reply to message #558966] Thu, 28 June 2012 03:41 Go to previous messageGo to next message
Charly2012
Messages: 2
Registered: June 2012
Location: bcn
Junior Member
Ok, thanks for answers
Re: Read file on local machine [message #559070 is a reply to message #558947] Thu, 28 June 2012 07:24 Go to previous messageGo to next message
matthewmorris68
Messages: 258
Registered: May 2012
Location: Orlando, FL
Senior Member

>DB Server side ONLY!

True, but potentially misleading. UTL_FILE can access any directory for which a directory object can be created. Where I work, the Oracle database is on a Linux server hosted in a data center. I've set up mount points on that server using CIFS mappings to a shared drive on another server (in a different data center) that is used by our Windows PCs. I have Oracle directory objects created against those mount points so that my database applications can read and write files accessible to my users on Windows clients.

So yes, there has to be a drive mapping and directory object on the database server before UTL_FILE can be used. However, that drive mapping *could* be to a client PC. I doubt that's practical in this case.
Re: Read file on local machine [message #559071 is a reply to message #559070] Thu, 28 June 2012 07:31 Go to previous message
Littlefoot
Messages: 21826
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Also, you (Charly2012) might be interested in some additional reading from the recent discussion (just to make things clearer (as mud)).
Previous Topic: How to replace values within loop?
Next Topic: Trigger impacting a Procedure in the package
Goto Forum:
  


Current Time: Tue Aug 26 13:07:47 CDT 2025