ADT in Oracle?

So I’ve been fooling around with DBMS_AQ and JMS message queues and found an interesting tidbit. There are two places that I know of that can accept virtually anything: XMLTYPE constructor and ENQUEUE/DEQUEUE functions from the DBMS_AQ package. Now this is not a common feature of a PL/SQL function.

This is a repost from my old blog that is now lost to time and carelessness. I found some of my drafts and reedited a handful that might be interesting to read.

So you might have read it before but it's not like I have a massive following so you probably haven't ;)

How it works? Glad you asked. These functions accept an argument of a very special type: "<ADT_1>". Being a naughty boy I went ahead and looked at the code in one of the built-in packages. Take a look.

-- The following data types are generics, used specially within package
-- STANDARD and some other Oracle packages.  They are protected against
-- other use; sorry.  True generic types are not yet part of the language.

type "<ADT_1>" as object (dummy char(1));
type "<RECORD_1>" is record (dummy char(1));
type "<TUPLE_1>" as object (dummy char(1));
type "<VARRAY_1>" is varray (1) of char(1);
type "<V2_TABLE_1>" is table of char(1) index by binary_integer;
type "<TABLE_1>" is table of char(1);
type "<COLLECTION_1>" is table of char(1);
type "<REF_CURSOR_1>" is ref cursor;

So, Oracle? Are we getting generics and ADTs in next versions? Maybe at least interfaces/protocols for a start?


2019 update

As I’m editing this post seeing 2019 fly by I have to report that there’s still no news on ADTs and generics in PL/SQL. To be honest, I’m long past caring.

I hope no one is seriously considering using PL/SQL for new projects in 2019. We have plenty of incredible tools for building applications around a database. Please let this technology die in peace already.