Hi,
I am using Oracle 11g and mostly works on tasks which requires data extraction for clients. I have been trying to automate the process of extraction and I found the below code in one of your answers.
---------------------------------------------------------------------------------
create or replace directory csv_dir as '/destination/for/csv';
create or replace procedure write_file is
begin
file_handle := utl_file.fopen('CSV_DIR', 'csv_filename.csv', 'w', 32767);
for rws in (
select * from t -- your query here
) loop
utl_file.put_line(file_handle,
rws.c1 || ',' || rws.c2 || ',' || rws.c3 -- your columns here
);
end loop;
utl_file.fclose(file_handle);
end write_file;
/
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'EXPORT_CSV_J',
job_type => 'PLSQL_BLOCK',
job_action => 'begin write_file; end;',
number_of_arguments => 0,
start_date => NULL,
repeat_interval => 'FREQ=DAILY',
end_date => NULL,
enabled => FALSE,
auto_drop => FALSE);
DBMS_SCHEDULER.SET_ATTRIBUTE(
name => 'EXPORT_CSV_J',
attribute => 'logging_level',
value => DBMS_SCHEDULER.LOGGING_RUNS);
DBMS_SCHEDULER.enable(
name => 'EXPORT_CSV_J');
END;
/
-----------------------------------------------------------------------------------------
But, when this will be executed, the directory will be created on server side which requires admin privileges.
I just want to know that is there a way so that I can create a directory on my local machine, so that I don't require admin privileges to extract and export the data to my defined path at local machine ??
Regards,
Arif Sher Khan