Embedded SQL is a tool that allows us to execute SQL statements in Caché Object Script. For example, to select the name of a person with a particular SSN from the Sample.Person class
&SQL(
SelectNameinto:tName
FromSample.Person
WhereSSN = :tSSN
)
The colon syntax is used to identify local variables, in this case tName and tSSN. &SQL indicates to our compiler that this is SQL syntax. At compile time, this statement will be optimized to executable Object Script code. More about this syntax can be found here.
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GSQL_esql
SQLCODE
