This Is Why You Should Know Several Languages

I’ve been working on PL/SQL a fair bit lately, and one of the things that it does incredibly nicely is type discovery. I’m specifically thinking of this mechanism:

CURSOR c(var IN table.file%TYPE)
IS
SELECT
  a
  , b
  , c
FROM
  d
WHERE
  e = var

c_row c%ROWTYPE

That declares a cursor, c, which takes a variable, var of the same type as the file column in table, then declares a row variable, c_row, which accepts an entire row fetched from c.

I’m kind of in love with this syntax, or at least momentarily infatuated. No temp table, no clumsiness. Just sweet, lovely, syntax-standard sugar.