Routines written in NZPLSQL

The NZPLSQL language can be used in addition to the SQL PL language.

SQL PL is a procedural programming language that can be used to write routines. NZPLSQL is a different procedural programming language that is similar to Postgres PL/pgSQL and is used by Netezza Platform Software (NPS). NZPLSQL statements and grammar describes NZPLSQL and its structure.

When you create a routine, the process by which it is compiled depends on the setting of the SQL_COMPAT global variable:
  • When SQL_COMPAT='NPS', the routine is a sent to the NZPLSQL cross-compiler, which converts it from NZPLSQL to SQL PL before sending it on to the SQL PL compiler. If a routine is written in SQL PL, the cross-compiler usually will realize this and will not attempt to convert it before sending it on to the SQL PL compiler. However, because the cross-compiler might mistake SQL PL code for NZPLSQL code, try to convert it, and fail, it is recommended that you do not submit routines written in SQL PL when operating in NPS compatibility mode.
  • Otherwise, the routine is sent directly to the SQL PL compiler. A routine written in NZPLSQL (or any other language) will almost certainly result in a syntax error.