I'm using sqlcl trying to execute a javascript to upload files into blob field.
https://github.com/oracle/oracle-db-tools/blob/master/sqlcl/examples/blob.helper.all.js
DB connexion it's ok bet when I ran the script I receive the following error:
SQL> script load_file_to_db.js
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "load" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
My script:
load('https://raw.githubusercontent.com/oracle/Oracle_DB_Tools/master/sqlcl/lib/helpers.js');
/* File name */
var files= helpers.exec('find . -maxdepth 1 -type f ').stdout.split('\n');
/* bind for reuse */
var binds = helpers.getBindMap();
for(f in files ) {
/* load the blob */
blob = helpers.getBlobFromFile(files[f]);
/* assign the binds */
binds.put("path",files[f]);
binds.put("b",blob);
/* Just do it */
var ret = util.execute("insert into k(path,blob_content,when) values(:path , :b, sysdate)",binds);
}