Command group Flag affected Reversible Execute on client Platform(s)
SQL Object Commands NO NO NO All


Sta: {sql-script}


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): note the Method Editor will enclose the complete text in curly brackets automatically, so these do not need to be entered.

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.


; 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)