Products Support Documentation Download

The RDM SQL Programming Language (SQL PL) is based on the ISO/IEC SQL Persistent Stored Modules (SQL/PSM) [2] specification. It provides a high-level language in which stored procedures and functions can be easily written, compiled and called within the RDM SQL system. In earlier versions of RDM SQL, except for a rudimentary stored procedure capability, all such programming needed to be done through a standard programming language API such as ODBC for C/C++ or JDBC for Java programs.

The SQL PL is a computationally complete programming language for use in RDM SQL stored routines (procedures or functions). The language is block structured with the ability to declare variables that conform to the usual scoping rules with, of course, an assignment statement so that values can be assigned to them. Control flow constructs provided include if-elseif-else and case statements and a variety of loop control constructs including while, repeat-until, and for loop statements.

Seamless access to SQL is provided through the ability to execute most SQL statements that can include references to locally declared variables. Also provided is the ability to declare cursors allowing rows from a select statement to be fetched into locally declared variables, allowing the result column values to be checked and manipulated within the stored routine.

Exception handling is also provided allowing handlers to be coded for specific or classes of errors or statuses returned from execution of an SQL statement. In addition, it is also possible to define a user condition and exception handler and for the program to signal its own, special-purpose exceptions.

Stored procedures are executed using the SQL call statement. Stored functions are executed by invoking them through their function names in any context in which an SQL expression can be specified.

Outside of a stored procedure or function (e.g., from a front-end tool that allows SQL statements to be submitted and executed such as rdm-sql) RDM SQL PL allows global variables to be declared and assigned values.