Problem in using UTL_FILE Package
Dear Mates,
I am trying to make use of UTL_FILE for inseting data in to the tables by reading the contents of a text file. I have set the UTL_FILE_DIR parameter by giving the path. Still i am not able to insert the records to the table.
The error I am getting is
ERROR at line 1:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "PRASANNA.LOADSTUDENTS", line 61
ORA-06512: at line 1
I have set the parameter UTL_FILE_DIR in INIT<SID>.ORA as
UTL_FILE_DIR=C:\developer
please help me out
It will be helpful if you can mail me at [email protected]
ORA-06512: at "PRASANNA.LOADSTUDENTS", line 61how looks like line 61 in your PRASANNA.LOADSTUDENTS function?
what's happening there?
From "Oracle Product Document Library":
ORA-06512 at string line string
Cause: Backtrace message as the stack is unwound by unhandled exceptions.
Action: Fix the problem causing the exception or write an exception handler for this condition. Or you may need to contact your application administrator or database administrator.
Similar Messages
-
Creating Error log files using UTL_FILE package on a remote machine
Database Version: 10g Release2
OS Platform: Sun Solaris
I have been asked to log errors to OS files rather than tables. So, i wanted to use UTL_FILE package. But the client doesn't want to store these files on the same server where the database is running(as specified in UTL_FILE_DIR). Is there a way i could get these files created on a remote machine(client).I believe what others are suggesting is that your stored procedure continues to log to a table and a separate process be created that runs on the machine you want the file to be created on which reads the log table and writes to a log file.
If that is not an option, can you expose the directory on the remote machine you want to write the file to as a file share that can be mounted by the database server? If you can, you could write errors there using UTL_FILE. However, it would probably be a bad idea. If you're logging an error already, that implies that something has gone wrong. Making an error logging process dependent on a remote server being available and properly mounted with appropriate privileges at the instant the error occurs just creates more sources of failure that would prevent you from logging an error, which would prevent you from being able to debug the problem or even know it existed without a report from a user.
Justin -
Archiving files generated by PL/SQL program using UTL_FILE package
Dear All,
We have on PL/SQL package that is generating some data files using UTL_FILE package in one specific directory.
I am working on concurrent program of type host(unix script) to move generated file to some archive folder.
Now the problem is owner of the files generated by PL/SQL is oracle and file permissions of the generated files are 644(Only read permission for group and others).
Concurrent program is using an another os user applmgr to execute the script attached with concurrent program.
Because applmgr is not having write permission on the files, hence mv command is failing.
Please suggest me how to resolve this issue.
Regards
Devender YadavHi;
I just think that, you can create one sh which is chancing permission of related path owner for applmgr user and put it on crontab and it can run every 1 min.
Regard
Helios -
Error while using UTL_FILE package
I am getting error while using UTL_FILE package in apex 3.0 version
Pls help me out.ok, how are you using UTL_FILE and what is the error?
-
Need to generate the excel file with diffrent sheets using utl_file package
Hi,
Sorry for previous message in which I had missed the usage of " UTL_FILE " package
I need to generate the excel file with diffrent sheets . Currently I am generating the data in three diffrent excel files using
" UTL_File " package and my requirement is to generate this in a single excel file with diffrent sheets.
Please help on this
Thanks & Regards,
Krishna VyavahareHello 10866107,
at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the packages behind second and fourth link support more than one worksheet.
Regards
Marcus -
Permissions on files created using UTL_FILE package
The files created on unix using UTL_FILE package have permisisons rw- - - - - - -.(600). I want them to be created with permissions 640.(rw-r - - - - - ).i.e read access to the group also. The umask setting of the unix account of the oracle instance are 137. Is there any way to create the files with the required permissions.
So SQL*Plus is on your PC? I'm assuming you mean 'call' as in the windows cmd.exe command?
Sheesh this is like getting blood from a stone.
In that case you must be connecting via the listener and not internally.
In which case the umask comes from the umask that was set in the environment of the OS user who started the listener process.
Thats not necessarily the same as the owner of the oracle software (normally 'oracle').
If sysdamin joebloggs logs in and starts the listener manually in a shell, then the umask applied to all shadow processes started by the listener is whatever jobloggs umask was when he typed the command 'lsnrctl start'. The umask of the owner of the oracle software, or your umask, is utterly irrelevent.
So if you don't like the umask for files created by processes spawned by the listener, stop and restart the listener in a shell where you have explicitly set the umask to what you want it to be.
Really starting the listener should be scripted and the correct umask is put in the script just before the call to 'lsnrctl start'. -
Problem while using UTL_FILE
Hi I am using UTL_FILE package for the first time. Code goes as below
Line:-----
create directory test_utl_file as 'C:\ORA File';
declare
file_handler utl_file.file_type;
v_newline varchar2(200);
begin
file_handler := utl_file.fopen('test_utl_file','TEST_UTL_FILE.txt','r');
loop
begin
utl_file.GET_LINE(file_handler,v_new_line);
dbms_output.put_line(v_new_line);
exception
when others then
dbms_output.put_line('-----------------------------');
dbms_output.put_line('End of line reached');
exit;
end;
end loop;
utl_file.fclose(file_handler);
end;
Line:-----
Eorror I am getting is
ORA-06550: line 2, column 14:
PLS-00201: identifier 'UTL_FILE' must be declared
But I can access the UTL_FILE package using DESC.
I am not able to understand the cause of error.796298 wrote:
I am connected to SYSTEM user. Does it still needs to be granted the privilege. If it needs should I connect to SYS and grant the privilege ?Generally it's not a good idea to be producing code in the SYSTEM or SYS schemas. You should only log into those to carry out admin tasks such as granting privileges.
Once you've granted your use the appropriate privilege to access UTL_FILE package you'll also need to alter a line in your code...
file_handler := utl_file.fopen('test_utl_file','TEST_UTL_FILE.txt','r');should be...
file_handler := utl_file.fopen('TEST_UTL_FILE','TEST_UTL_FILE.txt','r');The name of the directory object must be specified in UPPER case as that is the default case for objects created in oracle, and because it's passed as a string parameter to the FOPEN function, the case does matter. -
Problem to use J2EE Packages in Forte 3.0 CE IDE
I've got problems in using J2EE Packages in Forte for Java CE 3.0.
I can't use these Packages with the Forte IDE!
Example: import javax.jms.*;
The Error: Can't find javax.jms.* Package
What can I do to use the J2EE Package in the J2EE.jar?I post it so often, with a little bit different titles, cause the chance anybody helps looks better. Many People gave me so much help - but in so many different ways. So I changed the title of my Problem!
I thank you for your support and help
Bye -
Create a file and store it in the database using UTL_FILE package
Hello.
I'm using UTL_FILE package to store data from a table into an excel file but I don't know how to store this file in a table with a BLOB field the database at the same time. I want do do this because I will use it in a Oracle Portal.
Anybody has any idea how to do this?
Thanks & Regards,
AlexandraFrom Asktom
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:232814159006 -
Having problem in recognising file using utl_file package..
Hi,
I am using utl_file utility to read the CSV file, utl_file.fopen function is useed to open file. This fopen function has three input parameters, second parameter is file name. My problem is that, i have to read file on daily basis. File name will be like:- DDMMYYYYHHMISS. Last six characters are for hour minute second of the file generation time. If the name has only DDMMYYYY then I can give the file name like TO_CHAR(SYADATE,'DDMMYYYY'), because on a particular date its same for the whole day. But hours, minutes and seconds will be of the time when the file is generated, it may be different for different days. In this condition how can I standardize the value for file name parameter in fopen function.
Thanks in advance.Bharat Kaushik wrote:
Actually.....
I am gettting file from some other place..... And those people are not agreed to send file without exact time.JAVA solution is here
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:7506780031005
Or if you want PL/SQL .. (May Be kiddy)
--Please Note: SYSDATE is 26th in our DB.
SQL> declare
2 fp utl_file.file_type;
3 dt date := trunc(sysdate);
4 begin
5 while (dt <= sysdate) loop
6 begin
7 fp := utl_file.fopen('OGL_REPORT_ACCESS','TEST'||to_char(dt,'ddmmyyyyhh24miss')||'.csv','r');
8 dbms_output.put_line('TEST'||to_char(dt,'ddmmyyyyhh24miss'));
9 utl_file.fclose(fp);
10 exit;
11 exception
12 when utl_file.INVALID_OPERATION then
13 null;
14 end;
15 dt := dt + 1/24/60/60;
16 end loop;
17 end;
18 /
TEST26042009010102
PL/SQL procedure successfully completed.
Elapsed: 00:00:03.45
SQL> select sysdate from dual;
SYSDATE
26-APR-09 -
Writing files using UTL_FILE package
Greetings:
I'm attempting to write simple text files on the server side using the UTL_FILE package.I can get it to write the file to a local drive on the Oracle server with no problems, but not a network drive. When trying to write to a network drive, the FOPEN function raises the UTL_FILE.INVALID_OPERATION exception. This is even with my UTL_FILE_DIR parameter set the * for all directories and I have "Full Control" permission on the directory. I am running in a NT Server/Wkstn environment. Anyone have any ideas why I can't write a file to a network drive?
Thanks a lot,
Chris ScoppThanks for your response...
I have set the UTL_FILE_DIR parameter... I've tried setting it to the * for all directories and also mapping a drive letter from the server to where I want to write the file and then explicitly naming this path in the UTL_FILE_DIR parameter. Neither works, I still get the INVALID_OPERATION exception raised on the FOPEN function. I'm convinced now that it does have something to do with NT because I have been able to do the same operation writing to a Win95/98 box and it works fine. I have "Full Control" to all places I'm trying to write to, any other ideas?
Thanks a lot,
Chris Scopp -
Samples using UTL_FILE package
hello;
I would like to use the utl_file package: fopen, put_line ...
can you send me some samples using this package.
thanks to your help
mam
nulldeclare
T1 UTL_FILE.FILE_TYPE;
begin
begin
T1:= UTL_FILE.FOPEN
('/u02/applmgr/10.7p161/eye/3.3.1/out','filename.dat','w');
EXCEPTION
WHEN UTL_FILE.INVALID_PATH THEN
DBMS_OUTPUT.PUT_LINE('Invalid Path');
WHEN UTL_FILE.INVALID_MODE THEN
DBMS_OUTPUT.PUT_LINE('Invalid Mode');
WHEN UTL_FILE.INVALID_OPERATION THEN
DBMS_OUTPUT.PUT_LINE('Invalid Operation');
end;
UTL_FILE.PUT(T1,'PROD DATE ');
UTL_FILE.PUT(T1,'PRODUCT ');
UTL_FILE.PUT_LINE(T1,'INTEREST TYPE ');
UTL_FILE.PUT(T1,'LEASE NUMBER ');
begin
UTL_FILE.FCLOSE(T1);
EXCEPTION
WHEN UTL_FILE.WRITE_ERROR THEN
DBMS_OUTPUT.PUT_LINE('write error');
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
DBMS_OUTPUT.PUT_LINE('Invald File Handle');
end;
END;
mamoudou (guest) wrote:
: hello;
: I would like to use the utl_file package: fopen, put_line ...
: can you send me some samples using this package.
: thanks to your help
: mam
null -
Reading all files on directory using "utl_file" package...
I need to read all files in directory via PL/SQL. I don't know
name files (are data dynamics create for automation system),
only I know your extensions.
Can I do this using the package "utl_file" or I need to create
program in another language (C, C++, for example)?
Any ideas...
Thanks.Hi,
you can't do that with the UTL_FILE package (it can't retrieve
file names).
A very simple solution would be, if you created on OS-level a
file which contains the filenames of directory and then read this
file using UTL_FILE. With the information on all file names you
can enter a loop which opens and reads all files again using
UTL_FILE.
A more mundane solution could be to use the features on the iFS.
Cheers
Gerald -
Problem in Using Utl_Http package
Hi to all,
I'm trying to send the sms(Short Message Service) using utl_Http package. When I'm trying to run a sql statement like
SELECT utl_http.request('http://www.oracle.com/index.html') FROM dual
I'm getting an error message like this.
The following error has occurred:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1577
ORA-12545: Connect failed because target host or object does not exist
ORA-06512: at line 1
Pls help me to solve this problem.
Regards,
Alok DubeyThank you for ur reply. Infact my database was not able to access the internet. currently, it is working fine.
I'am using this code. It's works well.
CREATE OR REPLACE PROCEDURE Send_Sms_Http
AS
text_str VARCHAR2(5000);
V_Message VARCHAR2(200) := REPLACE('This is a DEMO SMS sent to u on '||TO_CHAR(SYSDATE,'DD/MM/RRRR HH12:MI:SS AM'),' ','%20');
text_sms VARCHAR2(5000) := 'http://hapi.smsapi.org/SendSMS.aspx?UserName=xxxx&password=xxxx&MobileNo=xxxx,xxxxx&SenderID=xxxx&CDMAHeader=xxxxx&Message='||V_Message;
BEGIN
text_str := utl_http.request(text_sms);
Dbms_Output.Put_Line('text_str = '||text_str);
EXCEPTION
WHEN OTHERS THEN
Dbms_Output.Put_line('Error in sending the message'||SQLERRM);
END;
Regards,
Alok Dubey -
Unable to write files in different m/c in LAN using utl_file package
I need to dump some files generated by utl_file package in a separate m/c not in the db server.For that I tried using utl_file_dir='*' and mapped the specified directory in the db server. but its failing as show below..
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 449
ORA-29283: invalid file operation
ORA-06512: at "ANIRBAN.WRITE_IN_FILE", line 9
ORA-06512: at line 1
The prototype sp is given below..
CREATE OR REPLACE PROCEDURE write_in_file(pInDir IN VARCHAR2,
pInFileName IN VARCHAR2,
pInFileContent IN VARCHAR2) IS
vFile UTL_FILE.FILE_TYPE;
vFileName VARCHAR2(20) := pInFileName;
BEGIN
dbms_output.enable(1000000);
vFile := UTL_FILE.FOPEN(pInDir, vFileName, 'w', 32000);
UTL_FILE.PUT_LINE(vFile, pInFileContent);
UTL_FILE.FCLOSE(vFile);
END write_in_file;
With this sp i'm able to write in genuine drives but not in mapped one.What shall be done to be able to write in a separate m/c freely.Plz guide meAnd make sure you specify the full path name of the server/directory path rather than using substituted drive names as is can sometimes be funny about that sort of thing.
Maybe you are looking for
-
How can i put more than one item in a same row of a form?
guys! it seems item is positioned in a single row one by one each time item is appened to a form. i can't append more than one item in same row. i'm using sun wtk and default colored phone emulator. xxxx
-
ITunes DJ and Coverflow / Top menu issue
Any updates on this subject? While in version 9 iTunes looked the same as in the thread above, looks have changed a bit now, but still look bad. I spent a lot of time building my library and do not feel like doing al this work again. If no satisfacto
-
Can't change info of music in iTunes 11.0.1
The other day I was updating my MacBook OS to OS X 10.8.2 with the latest version of iTunes 11.0.1. When I add legal music (not bought via iTunes Store) to my iTunes, I suddenly can't change the music info. Changing the properties to read and write d
-
Embedding flash files -- using swfobjects ?
hi all .. i've been posting flash files on my site for a year or so now, using artotems code. i find that it plays back erratically, sometimes on (what else?) IE machines ... i've just been delving into the world of swfobject. does this help your fla
-
ADOBE WON'T OPEN AND I NEED PDF READER NOW FOR TAXES!!!! PLEASE HELP!!!!!