oracle - how to give relative path of local filesystem in pl/sql block -
i trying insert clob xml file in local file system. below piece of pl/sql block.
declare xmlclobfile bfile := bfilename(bfile_dir, 'clob.xml'); tempclob clob; begin execute immediate 'create or replace directory bfile_dir '||''''||'/home/abc/data/emp/clobs'||'''' --clob insert dbms_lob.createtemporary(tempclob, true); dbms_lob.open(xmlclobfile, dbms_lob.lob_readonly); dbms_lob.loadfromfile(tempclob, xmlclobfile, dbms_lob.lobmaxsize); execute immediate 'insert emp_data (id, clob_data) values (1000, :1)' using tempclob; end; /
here when give absolute path (/home/abc/data/emp/clobs) works. when give relative path(like data/emp/clobs) , run sql /home/abc, doesn't work.
[exec] error @ line 1: [exec] ora-22285: non-existent directory or file fileopen operation [exec] ora-06512: @ "sys.dbms_lob", line 937 [exec] ora-06512: @ line 57
how provide relative path here, want run in machine , not mine. highly appreciated.
thanks
the relative path, if derive directory oracle "start" command run, e.g. /home/oracle. 1 way test this, , verify relative paths work (not used them myself) create directory pointing ".", , run test create file, search file. directory find find in start path. however, think unsafe, since oracle started folder (potentially), depending on if autostarted, or whichever dba on hand start it.
Comments
Post a Comment