Skip to Main Content

SQLcl: MCP Server & SQL Prompt

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!

Variables from js scripts live on in SQLcl past execution of the script?

ptflMay 11 2018 — edited May 16 2018

I just noticed, thanks to a typo, that variables I created in one js script stay available in SQLcl after execution and can be (in my case accidentally) referenced by subsequent scripts.

If I exit SQLcl and restart it again, it looks like variables are cleared -- is there a way to 'clear' all previous variables etc at the end of a script, or start of the next script, without having to exit and restart?

SQLcl version is 18.1.1, Oracle Server is 11g

My simple test of this is:

create "test_1.js" with single line of:

test_variable = "this is a test";

create "test_2.js" with single line of:

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

run the two scripts:

script "test_1.js"

script "test_2.js"

Output should be "this is a test"

This post has been answered by Gaz in Oz on May 11 2018
Jump to Answer

Comments

Post Details

Added on May 11 2018
3 comments
198 views