Skip to Main Content

SQLcl

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

sqlcl js script doesn't report errors?

wadamsApr 30 2025

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

This post has been answered by danmcghan-Oracle on May 5 2025
Jump to Answer
Comments
Post Details
Added on Apr 30 2025
3 comments
224 views