ksc_run_sql
This command runs a SQL query against the chosen environment. The result of the last row queried is returned in the [SQL_OUTPUT]
token. The result of the entire query is placed in the [AS.PKG_TRANSFER_PATH][PKGL.SEQ].txt
file in <ITG_Home>
.
To run this special command, any execution steps in the Change Management workflow must have their source environments defined in the Workflow Step window.
ksc_run_sql
parameters
Parameter | Default token | Description |
---|---|---|
QUERY_STRING | [QUERY_STRING] | A SQL select statement |
ENV_NAME | [ENV_NAME] | The name of the environment where data will be queried. The JDBC connection should be checked in the environment checker. |
EXCEPTION_OPTION | [EXCEPTION_OPTION] | If no data is returned, determines if an exception should be thrown. The only available option is '-no_data_exception.' |
Example using ksc_run_sql
ksc_run_sql QUERY_STRING="select sysdate from sys.dual" ENV_ NAME="[SOURCE_ENV.ENVIRONMENT_NAME]"
Note: The ksc_run_sql
special command can be used to populate a validation. This is appropriate when the validation is validated by a Command with Delimited Output. In this case, the Data Delimiter should be set to “#@#
”.
The following code is an example of ksc_run_sql
in a validation.
ksc_run_sql QUERY_STRING=”select id, name from some_table” ENV_NAME=”[SOURCE_ENV.ENVIRONMENT_NAME]” ksc_capture_output cat [AS.PKG_TRANSFER_PATH][PKGL.SEQ].txt