NAME
SQLexec - Execute an SQL statement inside tcl

SYNOPSIS
SQLexec result_array sql_statement

DESCRIPTION

The SQLexec command executes the SQL statement sql_statement. If the SQL statement is not a select, then result_array can be null. If the SQL statement is a select, then the output is returned as a Tcl array in result_array (See SQLselect for more information). SQL errors are handled by appending the SQL error message to the results and returning TCL_ERROR.

If sql_statement is a select, then SQLexec returns the number of rows that the select returned. If sql_statement is not a select, then the empty string is returned.

This command uses a private, statically allocates SQL Data Area (SQLDA). The private SQLDA is allocated during the first call to SQLselect or SQLexec.

EXAMPLE

This command will select all the columns in table vertex2 of database dbdict:
        SQLopendb dbdict
        # The SQL statement is not a select so the result_array
        # can be null.
        SQLexec {} grant select on tables to public
        SQLexec results select * from vertex2
        # Print the contents of the result array
        parray results
        SQLclosedb

KEYWORDS
database

SEE ALSO
SQLselect(3)

BUGS
Note that Ingres 6.4 does not allow interleaved access to two open cursors. Commands like SQLfetch and SQLexec both access two different cursors.