JS RUN

Core command JS RU JSRU

Runs a saved .js script from the JS scripts catalog, optionally passing positional arguments

Arguments

<file> (mandatory) a file name (with its .js extension) or @alias; [args...] (optional) positional arguments bound as args[0], args[1], ...

Examples

JS RUN migrate_active_customers.js;
JS RUN migrate_active_customers.js PROD_ORDERS ARCHIVE_DB;

Notes

Runs a saved .js script from the JS scripts catalog: JS RUN <file> [args...].

<file> is resolved against the JsScripts catalog (relative path, @alias, or unambiguous bare file name) the same way CommandJsList/CommandJsFind enumerate it. Unlike SCRIPT RUN/LIB RUN, the extension-optional convenience does not apply here: JsScripts is kept in its own folder specifically so FileCatalog's existing, unmodified .sql auto-append behavior (shared with LIB/SCRIPT) is not disturbed, so a bare name with no extension will not resolve to a .js file; pass the file name with its .js extension, or a declared @alias (which matches regardless of extension). Any trailing tokens after <file> are bound into the script as args (args[0], args[1], ...). Also prints a one-line warning, without refusing to run, for each of the entry's @instance/@environment metadata that doesn't match the current connection's instance/environment, the same convention as SCRIPT RUN.

Last modified in release 5.1.2.