Business Process and Data Transformation Language Reference
Execute an embedded SQL SELECT
statement within a data transformation.
<sql><![CDATA[ SELECT SSN INTO :context.SSN FROM MyApp.PatientTable WHERE PatID = :request.PatID ]]> </sql>
||Optional. A text string that describes the <sql> element.
The DTL <sql> element executes an arbitrary embedded SQL SELECT
statement from within a DTL <transform>
To use the <sql> element effectively, keep the following tips in mind:
Always use the fully qualified name of the table, including both the SQL schema name and table name, as in:
The contents of the <sql> element must contain a valid embedded SQL SELECT statement.
It is convenient to place the SQL query within a CDATA block so that you do not have to worry about escaping special XML characters.
Any tables listed in the SQL query’s FROM clause must either be stored within the local InterSystems IRIS database or linked to an external relational database using the SQL Gateway.
Within the INTO and WHERE clauses of the SQL query, you can refer to a property of the source or target object by placing a : (colon) in front of the variable name. For example:
SELECT Name INTO :target.Name
WHERE SSN = :source.SSN AND City = :source.Home.City
Only the first row returned by the query will be used. Make sure that your WHERE clause correctly specifies the desired row.