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;
Breaking results into week blocks
I have a set of dates (and times), which are returned from a mySQL query.These usually span from 1-2 months and I need to be able to separate the results (using HTML) every sunday (monday being the
Local file browser with php
Halo..So this is what i want to create. I have a folder that i share and it has many movies..So i will setup a local web browser and i want to make a .php file that after you login it will saw you the
Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data update current data or delete old data from tempproducts to products then it will delete the
Packet Design
Hi All,Im new about network programming and I want to design a protocol but I have some questions about packet desing. For example I wanna do a sturct to send informations like that ;struct info {
How to convert this array to string
I am having problems converting this array to a stringusing print_r($val[1]); I get: Code: [Select]Array( [0] => Array ( [name] => John ) [1] =>
Hit counter updating once per IP - IP HIT COUNTER
I have a hit counter, for the amount of views on a tutorial.It'll do the query and then do..$views = $row['views'] + 1;Then insert $views into the database.This updates the view for each refresh of
form variables from database help.
Hi all,I would like to have a form that gives you options based on the results of an mysql query.My example is this, say I have a mysql row with the colum name points and the result is 5. How would I
Apple's revamped lineup arrives
I'm personally curious about the magic mouse.. a multi-touch concept sounds like it could be neat.. just wonder if it performs as well as a mouse w/ trackball. I'm also curious as to why no 24"
Class not found error
I am getting Class 'index' not found in Eval function://write config $path = dirname(__FILE__).DS.'..'.DS.'paymentclass'; if ( $model->payment_class ) { if
On page view, minus credit
Hello all, please, I need a little help with this script. I am charging one credit (credits can be purchased, but that is unrelated) for view of a certain page. I need help in figuring out what php I