Category Archives: Oracle Database

Imitation is the Sincerest Form of Flattery

Compilers and Interpreters Compatible with PL/SQL

The PL/SQL programming language, created by Oracle, is the most well-known database-oriented procedural language in existence. While everyone who knows about PL/SQL knows it’s available in the Oracle Database, what most people don’t know is that a number of companies and individuals have implemented their own compilers and interpreters for the PL/SQL language.

This article, an aside in my Demystifying PL/SQL series, contains a list of notable PL/SQL implementations I’m aware of. Like an old post I had done on Data UnLoaders for Oracle, the goal of this post is to track all non-Oracle implementations of PL/SQL. This will accompany another blog post on PL/SQL-inspired procedural languages.

Note: I don’t consider college projects and source-to-source translators to be notable.

(In order from oldest to newest)

Oracle PL/SQL
The Big Kahuna. This is the canonical implementation of PL/SQL by Oracle. None of the following implementations are, or will ever be, as full-featured or support nearly as many optimizations. In development for over thirty years, it’s a marvel of compiler engineering. Oracle’s PL/SQL implementation is available in Oracle Database, Oracle Forms, and Oracle TimesTen.

MaxDB, previously known as SAP DB, previously known as ADABAS D, is a mixed open-source/commercial database system from SAP AG. As SAP is a business applications company, it has long competed with Oracle. Unfortunately for SAP, the majority of their customers ran their application on top of Oracle Database. This made their customers an easy target for Oracle. As such, SAP began adding Oracle compatibility features so that their customers could run on top of their own database. While the PL/SQL prototype code is no longer public, MaxDB is implemented in Pascal, C, and C++.

Universal Procedural Language Compiler
My own optimizing compiler, dating back to 1999, that is compatible with a large subset of PL/SQL. Over the years, I’ve rewritten it three times. While it currently generates code using LLVM, it once had interpreters written in C, PHP, and JavaScript – enabling it to execute practically anywhere. The UPL has frontends compatible with SQL/PSM, Transact-SQL, and PL/SQL. The UPL compiler toolkit and runtime is implemented in C.

ANTs Data Server
While it’s no longer available, ANTs Data Server included an optimizing compiler for PL/SQL and Transact-SQL.

Also billed as Oracle-mode Firebird, Fyracle was an Oracle-compatible database based on the Firebird RDBMS. The developer kit, licensed separately, compiled a subset of PL/SQL into bytecode for the BlueBird Virtual Machine. In addition to PL/SQL support, Fyracle came with a few common built-in functions compatible with Oracle. While it is neither developed nor supported, Fyracle’s claim-to-fame was enabling people to run the Compiere open-source ERP system on Firebird instead of Oracle Database. Compiere has since moved to support EnterpriseDB Advanced Server in addition to Oracle Database. Fyracle and it’s PL/SQL compiler were implemented in C++.

Superset Procedural Language (SPL)
EnterpriseDB Advanced Server is a fork of the PostgreSQL RDBMS designed to be compatible with Oracle Database. Advanced Server contains a fork of the PL/pgSQL procedural language interpreter, called SPL, that has been enhanced to support packages and basic user-defined ADTs. EnterpriseDB and SPL are implemented in C. I worked on this interpreter.

IBM added support for a large subset of the PL/SQL language, including support for several built-in packages, functions, and Oracle Database syntax. I worked on this project.

This is a product from TmaxSoft. It claims fairly high compatibility with Oracle and PL/SQL. I haven’t played with it much, but I’ve heard it’s one of the most complete third-party implementations of PL/SQL. It is implemented in C.

StepSqlite was a cloud-hosted compiler from MetaTranz, LLC. It billed itself as a PL/SQL Compiler for use with SQLite and BerkelyDB. It was actually recommended by Oracle for users who wanted to use PL/SQL with BerkeleyDB. StepSqlite is implemented in C++.

SpliceMachine supports a subset of the PL/SQL language to ease migration off of Oracle Database. This is implemented in Java.

Gunnar Ruhs’ PL/SQL Compiler
While this only supports a tiny subset of PL/SQL, it is the only self-hosting PL/SQL compiler I’m aware of. It’s a single-pass compiler designed to run under, and generate code for, Microsoft Windows. It is bootstrapped using Oracle PL/SQL.

HPL/SQL is a simple open-source interpreter that supports a subset of ANSI/ISO SQL/PSM, PL/SQL, and Transact-SQL syntax. HPL/SQL is implemented in Java as an ANTLR parse tree visitor.

Oracle Mode MariaDB
MariaDB, a fork of MySQL, implemented support for a subset of PL/SQL within their current stored procedure engine. This is implemented in C++.

Similar to EnterpriseDB Advanced Server, KingbaseES is a Chinese-based fork of the PostgreSQL RDBMS, designed to be compatible with Oracle Database. Likewise, KingbaseES contains a fork of the PL/pgSQL procedural language interpreter with support for a subset of PL/SQL. KingbaseES PL/SQL is implemented in C/C++.

Universität Tübingen’s PL/SQL to Recursive SQL Translator
While this is technically a source-to-source translator, I find it notable as it’s structured as a compiler: the frontend parses a user-defined PL/SQL function, it’s translated to an intermediate form, and the backend emits an equivalent plain (WITH RECURSIVE) SQL query. It’s an interesting academic project.