ORA-01031: insufficient privileges
In order to use
dmbs_scheduler.get_file
in a procedure/function, the caller needs to have the system privilege
create external job
, otherwise, the following produces
ORA-01031: insufficient privileges.
create or replace function tq84_get_file(filename varchar2, cred varchar2) return clob
authid definer
as
content clob;
begin
dbms_lob.createTemporary(content, false);
dbms_scheduler.get_file (
source_file => filename,
source_host => null,
credential_name =>'RENES_CREDENTIALS',
file_contents => content
);
return content;
end tq84_get_file;
/
begin
dbms_output.put_line(tq84_get_file('C:/Users/rene/staging/abc.csv', 'RENES_CREDENTIALS'));
end;
/