Database Research Group

WSI – Database Systems Research Group

PL/SQL Without the PL

Denis Hirn, Torsten Grust

Proceedings of the 39th ACM SIGMOD Int'l Conference on Management of Data (SIGMOD 2020), Portland, Oregon, USA, June 2020.

Online version

We demonstrate a source-to-source compilation technique that can translate user-defined PL/SQL functions into plain SQL queries. These PL/SQL functions may feature arbitrarily complex control flow—iteration, in particular. From this imperative-style input code we derive equivalent recursive common table expressions, ready for execution on any relational SQL:1999 back-end. Principally due to the absence of PL/SQL↔SQL context switches, the output plain SQL code comes with substantial runtime savings. The demonstration embeds the compiler into an interactive setup that admits function editing while live re-compilation and visualization of intermediate code forms happens in the background.