Using SQL to access data

Even though the OutSystems DSL provides actions for extracting, loading, transforming and updating data, sometimes complex queries must still be written to an existing or imported database as part of an organization's pages, business logic or workflow.

With OutSystems, it is possible to use standard SQL to query the database that is being targeted. The built-in advanced SQL editor enables developers to define input and output parameters and to write the SQL using everything the database supports. Simply use the domain entity names instead of the database table names, and OutSystems will pass the query to the database engine. In addition, all parameters are automatically protected from SQL Injection by default unless someone overwrites them.

Example from a complex query:


The query is fully tracked in the model. If there is a change to the database or domain model, such as a table column name change, the query will be automatically refactored. If a column in the application is deleted or if the application becomes invalid in some other way, OutSystems prompts the team and guides them through all inconsistencies. In addition, performance reports of queries that may be affecting application performance are available.