Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: PL/SQL Help Needed.
K.M. Cheng <kcheng_at_worldonline.nl> wrote in message
news:8gehfh$ccr$1_at_nereid.worldonline.nl...
> I was wondering if someone can tell me how i can read the content of a
file
> with PL/SQL.
> Is there a function to read in a flat/text file?
>
> Thanks!
> KC.
>
CREATE OR REPLACE PROCEDURE ReadFile (File_Path VARCHAR2,File_Name VARCHAR2)
AS
f_handle UTL_FILE.FILE_TYPE;
str VARCHAR2(100);
BEGIN
f_handle:=UTL_FILE.FOPEN(LTRIM(RTRIM(File_Path)),File_Name,'r');
WHILE TRUE LOOP
UTL_FILE.GET_LINE(f_handle,str);
and you can write to a file with UTL_FILE.PUT_LINE() ...
Note: you have to include the UTL_FILE_DIR = <path> parameter in your init.ora to specify the directories to perform file I/O. Received on Tue May 23 2000 - 00:00:00 CDT
![]() |
![]() |