You can embed SQL within ObjectScript.
Embedded SQL allows you to include SQL code within an ObjectScript program. The syntax is &sql( ). For example:
&sql( SELECT Name INTO :n FROM Sample.Person )
WRITE "name is: ",n
Embedded SQL is not compiled when the routine that contains it is compiled. Instead, compilation of Embedded SQL occurs upon the first execution of the SQL code (runtime).
For further details, see Using Embedded SQL.
Other Forms of Queries
You can include SQL queries in other ways within ObjectScript, by using the API provided by the %SQL classes. See Using Dynamic SQL.