Sta:

Command groupFlag affectedReversibleExecute on clientPlatform(s)
SQL Object CommandsNONONOAll

Syntax

Sta:
sql-script

Description

This command appends script data to the SQL buffer for the current method stack.

The Begin statement command clears the buffer ready for a new statement. The sql-script parameter is a text field which can contain square bracket and indirect square bracket notation (which you use to send data to the server as a "bind" variable).

Multiple Sta: sql-script lines are added to the SQL buffer, and separated with the delimiter(s) specified by the Begin statement command. This allows you to split a SQL statement over more than one line, but note that literal values must not be split between lines. The SQL buffer can contain more than one SQL statement provided you use the appropriate statement delimiter.

Text loaded into the buffer must be valid SQL, and must be understood by the server. You can use square brackets to load the buffer with text obtained from Omnis functions, variables and calculations. Indirect bind variable notation of the form @[Field] is not evaluated in Omnis but is handled by the DAM, and lets you pass field values to the server without the need for them to be included in the text of a SQL statement.

Example

# Open a multi-threaded omnis sql connection to

# the datafile mydatafile and create a statement to

# delete rows from the table Customers

Calculate
 
lHostname
 as 
con
(
sys
(115),
'mydatafile.df1'
)

Do
 
iSessObj
.
$logon
(
lHostname
,
''
,
''
,
'MYSESSION'
)

Do
 
iSessObj
.
$newstatement
(
'MyStatement'
)
 
Returns 
lStatObj

 
Begin statement
Sta:
Delete From Customers

Sta:
Where Cust_ID > 100

Sta:
And Cust_ID<110

End statement
Do
 
lStatObj
.
$execdirect
()

 
Do
 
lStatObj
.
$fetch
(
lMyList
,
kFetchAll
)