Skip to Main Content

Creating PL/SQL with LLMs

I've been playing around with local LLMs that are supposed to be good at coding, to see if they could be useful for creating PL/SQL code.
To see what is possible at this moment in time, I used LM Studio to ask some local LLMs one simple question:
"write an oracle pl/sql function to calculate the date of Easter sunday"
If you really want to dive into that one: https://en.wikipedia.org/wiki/Date_of_Easter.

Of course this is a very limited test; just one question and a very limited number of LLM models.
But it's a lot of fun to run them locally and see what a fairly powerful PC (AMD Ryzen 9 5900X, 64 GB RAM, Nvidia 5060 Ti with 16 GB VRAM) can do.
And with most models, if you point out the obvious mistakes they will correct them (most of the time), leaving you with useable code - or at least, something you can rework into something useful.

I created a package with all the "first pl/sql result" functions the LLMs generated, so without any fine-tuning done.
Some results needed tweaking to get them to compile; I noted those changes, and added my comments, in the functions themselves. Check out the code below.

Since I already have a page to calculate Easter sunday, comparing that code and the results (if any) of the code generated by the LLMs is easy enough.
In the "Models and Results" overview below, I listed the models and variants I tested, plus some test results (for 1538 and 4909, which are the limits of the Gregorian calendar, and some years around now).
Only 4 functions produced any results, of which only 3 got it right most of the time.
For the year 4909, those 3 got a different result than my own function (which says April 13th instead of 14th).
Since those 3 agreed with each other, I assume my function is wrong on that one - but I haven't found a source online I trust 100% to verify this.

Models and Results

Model NameVariantSize (GB)Parameters (B)VerdictR 1583R 2026R 2027R 2028R 2029R 2030R 2031R 2032R 4909
essentialai/rnj-1Q8_08.88.3
1583-04-102026-04-052027-03-282028-04-162029-04-012030-04-212031-04-132032-03-284909-04-14
google/gemma-3-27bQ4_016.427
google/gemma-3-4bQ4_K_M3.34
google/gemma-3n-e4bQ8_07.46.9
1583-04-102026-04-052027-03-282028-04-162029-04-012030-04-212031-04-132032-03-284909-04-14
mistralai/devstral-small-2-2512F164824
mistralai/devstral-small-2-2512Q3_K_L13.324
1583-03-182026-03-222027-03-212028-03-202029-03-202030-03-192031-03-252032-03-254909-03-10
qwen/qwen3-coder-nextQ4_K_M48.580
1583-04-102026-04-052027-03-282028-04-162029-04-012030-04-212031-04-132032-03-284909-04-14
qwen/qwen3.5-35b-a3bQ4_K_M22.135
qwen/qwen3.5-35b-a3bQ8_037.835
zai-org/glm-4.7-flashQ8_031.830

Code

Region

Identification
Sequence
Title
Type
Source
Location
Query Type
Table Name

View

View
Name
DDL

Package

Package
Name
Source

Package Body

Package Body
Name
Source