Purpose

SYS-SQL executes an SQL statement immediately

Syntax

#variable = SYS-SQL(statement)

Syntax Elements

#variable                    is a numeric scratch variable.  This is returned with the DBMS-specific SQL
status code.

statement                     is a string literal, string variable or string expression defining any SQL statement with the exception of the following:

Any references to 'host' variables.

Any statement referencing a cursor (that is, row-processing).

Any transaction control statement (COMMIT WORK or ROLLBACK WORK).

Any SELECT statement, since host variables would be implicit, (but SELECT sub-queries are permitted).

Database connection and disconnection statements.

Refer to the appropriate RDBMS section for details.

Remarks

The use of  SYS-SQL allows all the text of an SQL statement to be constructed at run time, rather than having to be declared at gen time as per  the Full Function mode statement.  This statement cannot exceed 250 characters.

Example

#STAT = SYS-SQL("CREATE TABLE  " + $TABLE_NAME +
$TABLE_DESCRIPTION)

Creates an SQL table using the name and description previously set in the PROIV variables.

Comment on this topic

Topic ID: 720253

Table of Contents

Index

Glossary

-Search-

Back