Hi
I have a file in certain path with the following permissions (The file is a dummy file without
any contents)--Zero byte file.
Permissions -rw-r--r--
I need to check if the file exist or not irrespective of file permissions,Is it possible.
If the file exist call a pl/sql and delete the file
else
Simply print a message.
I have written the following code but
I am getting the following error.. when file exist with above permisison, it will not call
the pl/sql
====================================
After opening utl file File name is :xx.txt
File exists xx.txt at /gpsescs1/custom/gl/inbound
Invalid operation because File does not exist-29283 ORA-29283: invalid file operation
====================================
If the file is present with rwxrwxrwx it completes normal by calliing the pl/sql
================
if the file is not present in the directory
it shows the following message
Invalid operation because File does not exist-29283 ORA-29283: invalid file operation
ORA-06512: at
"SYS.UTL_FILE", line 488
ORA-29283: invalid file operation
========================
declare
v_data_file UTL_FILE.FILE_TYPE ;
v_location VARCHAR2(250):='/gpsescs1/custom/gl/inbound';
v_file_name VARCHAR2(250):='xx.txt';
v_exists BOOLEAN ;
v_f_len NUMBER ;
v_bsize NUMBER ;
BEGIN
v_data_file := UTL_FILE.FOPEN(v_location,v_file_name,'r');
dbms_output.put_line('After opening utl file File name is :'||v_file_name);
UTL_FILE.fgetattr(v_location, v_file_name, v_exists, v_f_len, v_bsize);
--if file exist then delete the existing file
IF v_exists THEN
dbms_output.put_line('File exists '||v_file_name ||' '||'at '||v_location);
--remove the existing file from the inbound directory if errored out
UTL_FILE.fremove (v_location,
v_file_name
);
--call to plsql
dbms_output.put_line('Deleted the file '||v_file_name ||' '||'at '||v_location);
ELSE
dbms_output.put_line('file does not exist '||v_file_name ||' '||'at '||v_location);
END IF;
UTL_FILE.FCLOSE(v_data_file);
--close the file
EXCEPTION
WHEN utl_file.invalid_mode THEN
dbms_output.put_line('invalid mode'||SQLCODE||' '||SQLERRM);
WHEN utl_file.invalid_path THEN
dbms_output.put_line('invalid path'||SQLCODE||' '||SQLERRM);
WHEN utl_file.invalid_filehandle THEN
dbms_output.put_line('invalid File handle'||SQLCODE||' '||SQLERRM);
WHEN utl_file.invalid_operation THEN
dbms_output.put_line('Invalid operation because File does not exist'||SQLCODE||' '||SQLERRM);
WHEN utl_file.write_error THEN
dbms_output.put_line('invalid write error'||SQLCODE||' '||SQLERRM);
WHEN utl_file.internal_error THEN
dbms_output.put_line('invalid internale error'||SQLCODE||' '||SQLERRM);
WHEN utl_file.file_open THEN
dbms_output.put_line('invalid file open'||SQLCODE||' '||SQLERRM);
WHEN utl_file.invalid_filename THEN
dbms_output.put_line('invalid File name'||SQLCODE||' '||SQLERRM);
WHEN utl_file.access_denied THEN
dbms_output.put_line('invalid access denied' ||SQLCODE||' '||SQLERRM);
WHEN OTHERS THEN
dbms_output.put_line('Exception Occured'||SQLCODE||' '||SQLERRM);
end;
Question about ShowWindow()
Hello....I'm struggling with sumpin, and I hope y'all can help.I've got a CFormView with a small web browser control (CWebBrowser2), that only needs to be displayed occasionally, when a user selects a
Create a form of 2 numbers input and find the greatest.
Hi, everybody.I have a homework in my training of php, which ask you to make a form that asks you to input 2 numbers and so tell you which number is greater than the other.I need to know how to make
SQL query not working well
Hi,
Adding delete feature to my forum
Hello I am currently trying to add a delete feature to my forum. I believe I have everything built right but I am having some problems when debugging. I do not have PHP Designer 2008 and I am using
New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understand simple arrays, associative arrays, and multidimensional arrays also. The book I am reading
PHP Directory Listing Not working
Hey Guys,I need help, I tried a ton of directory listing scripts and they all don't work. Althogh the normal Apache Directory Indexing does work when you visit. The URL is
Which PHP-Editor do you think is the best?
Hi everyone, Myself Brian Anderson. For the last 2 years i have been working as a php-professional. I would like to conduct a poll for knowing which PHP-Editor you guys think is the
values not being entered into table
hi. I;ve created a form, so that when a user enters data into it, it gets added to a table in a database. the form submits some data to one table, and other data to another table. my problem is that
Execure stored procedure on a timer
Can someone tell me an easier way to execute a stored procedure on a timer? I am using Oracle 10g R2 DB on windows 2003 server. I have a batch file that calls an SQL file, which runs fine when I
IP question
ive got 2 ip addresses both global from same user how would i detect if they are local to each other