Forum Stats

  • 3,734,236 Users
  • 2,246,916 Discussions


Substitution variables in SQLcl Javascript

Erik van Roon
Erik van Roon Member Posts: 57 Red Ribbon

Hope somebody can give me some insight in what I'm doing wrong.....

I'm playing around with some javascript scripts for SQLcl (disclaimer: I know little javascript).

According to (the comments in the script in) this post by Kris Rice:

the substitution variables that are defined in SQLcl can be accessed through a collection of type "map".


Now, according to this

a map has a number of methods and properties.

Of that list the get(), set() and size() work like a dream.

But has() and delete() tell me "null is not a function", see screenshot.

Why is this? What am I doing wrong or what am I misunderstanding?

Especially has() is one that I would really like to use.

Example with size() which works and has() which doesn't:


 // Function writes text and an end-of-line to screen

 function writeLine (line) {

  ctx.write (line + "\n");



 writeLine ("Number of defined substitution variables: " + ctx.getMap().size());


 if (ctx.getMap().has("MY_VAR")) {

  writeLine ("Variable exists");

 } else {

  writeLine ("Variable does NOT exist");



Sign In or Register to comment.