SQL

Creates a database connection, then executes a SQL statement such as INSERT or UPDATE when given the data source and credentials. Then it closes the database connection.

Note: SQL() is valid only in the START: or FINISH: sections.

Syntax

SQL(dsn, username, password, string)

Arguments

Argument Description Default
dsn Data source name None
username User name None
password Password None
string SQL statement None

Results

Result Description
Return None
%%RC 0 success
-1 Invalid dsn or credentials
-2 Invalid statement
%%RM SQL message
%%RV Always set to 0

Examples

Function Call Return
%%SQL_STATEMENT = "INSERT INTO SW_RUNS (doc_count,

byte_count) VALUES (" | %%DOCUMENT_NO | "," | %%OUT_TOT_BYTE)"

SQL (MYDATALOGGINGSOURCE, ‘user123’, ‘abcdef’, %%SQL_STATEMENT)

None