Syntax
Another script file can be executed from within a running script using the syntax:
@@RELATIVE FILE NAME
@FILE NAME
The @@ form resolves the file name relative to the folder of the script that contains
the statement. The @ form takes the file name as given, so it also accepts an absolute
path. Both forms accept a defined variable, which allows a script to execute a
file it generated itself.
The statements of the executed file run within the calling script: variables defined
before the call remain in force, and a local on error mode set by the caller
continues to apply. The execution shows up as a separate run in the Invantive Script data
dictionary, with parent_run_id referring to the calling run and nesting_level one
higher.
Examples
To execute a script file located next to the current one:
@@cs-build-contact-persons.psql
To execute a script file by absolute path held in a variable:
local define CORE_BUILD_FILE "c:\temp\build\core-build.sql"
@${CORE_BUILD_FILE}
This second form is what turns a query into executable statements. A script can write the statements it wants to run with local export results and then execute that file, which is how a build script runs one local host statement per product without knowing the list of products beforehand.