TurboSQL Guide

Programming Language

Previous  Top  Next


This feature is only available in TurboDB Managed.

TurboSQL provides language elements to create routines that can be called from SQL commands.

User-defined functions

Functions are used to simplify SQL commands and to provide additional functionality. They can be coded either in TurboSQL or be imported from a .NET assembly. Functions can only have input parameters and always calculate a return type. They must not have side-effects. Functions are managed using the CREATE FUNCTION and DROP FUNCTION statements. Functions can be used for computed indexes, computed columns and checks.

User-defined procedures

Procedures are used to call complex sequences of SQL statements with a single statement. For example, using a procedure, multiple rows can be updated in different tables in one step. Procedures can be implemented either in TurboSQL or be imported from a .NET assembly. Procedures are managed using the CREATE PROCEDURE and DROP PROCEDURE statements.

User-defined aggregates

Aggregates compute accumulated values in result set groups. They can be used for example to compute the 2nd order maximum, the standard deviation or other accumulated values from a grouped result set. Aggregates are implemented in a .NET assembly and managed with the CREATE AGGREGATE and DROP AGGREGATE statements.

Statements

CREATE FUNCTION Statement

CREATE PROCEDURE Statement

CREATE AGGREGATE Statement

DROP FUNCTION/PROCEDURE/AGGREGATE Statement

DECLARE Statement

SET Statement

WHILE Statement

IF Statement

CALL Statement

Other topics

Exchanging parameters with .NET Assemblies