sqlcl 24.4.3.070, graalvm 17
I created a script with a select statement with invalid table name. And it runs as if there are no errors? Not sure what I’m doing wrong and can’t find any clear documentation on it (I pulled my error checks below from various blog sources).
SQL> script
var binds = {};
var objects2 = util.executeReturnList(
“SELECT ‘x’ col1, ‘y’ col2 from dBADual”
,binds);
if(objects2) {
ctx.write(“successful\n”);
} else {
ctx.write(“Error :(\n”);
var err = util.getLastException();
ctx.write(“\nERROR:” + err + “\n”);
}
if (ctx.getProperty(“sqlcl.error”)) {
throw new Error(ctx.getProperty(“sqlcl.last.err.message”));
}
for (i = 0; i < objects2.length; i++) {
ctx.write("cols: " + objects2[i].COL1 + "\n");
}
ctx.write("invalid stmt executed\n\n");
/
successful
invalid stmt executed