Skip to Main Content

Creating PL/SQL with LLMs

I've been experimenting with local LLMs that are reputed to be good at coding, to see whether they could help generate PL/SQL code.
To see what is possible at this moment in time, I used LM Studio to give some local LLMs one simple request:
"write an oracle pl/sql function to calculate the date of Easter sunday"

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 usable 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 - just some formatting applied to make them look more uniform.
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 with the results (if any) of 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 half of the models functions produced any results, of which only one half again got it right most of the time.
For the year 4909, those ones got a different result than my own function (which says April 13th instead of 14th).
Since they all agreed with one other, I assume my function is wrong on that one - but I haven't found a source online I trust 100% to verify this...
If you really want to dive into that calculation, here's a good starting point: https://en.wikipedia.org/wiki/Date_of_Easter.

So far, essentialai/rnj-1, google/gemma-3n-e4b, google/gemma-4-e4b and openai/gpt-oss-20b are my favourites. They are fairly small (and therefore quite fast) and produce useful results.
I didn't expect the larger versions of gemma3 and gemma4 to perform worse than their smaller siblings. Interesting.
Also surprising to see that google/gemma-4-e4b did a bit worse than google/gemma-3n-e4b. But as we all know, N=1 is not a comprehensive test...

Models and Results

Model NameVariantSize (GB)Parms (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-12bQ8_013.412.0
1583-03-012026-07-012027-03-012028-04-012029-07-012030-03-012031-06-012032-07-01-
google/gemma-3-27bQ4_016.427.0
---------
google/gemma-3-4bQ4_K_M3.34.0
---------
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
google/gemma-4-26b-a4bQ4_K_M18.026.0
1583-04-092026-04-082027-03-282028-04-162029-04-052030-03-252031-04-132032-04-024909-03-25
google/gemma-4-e4bQ8_09.07.9
1583-04-102026-04-052027-03-282028-04-162029-04-012030-04-212031-04-132032-03-284909-04-14
mistralai/devstral-small-2-2512F1648.024.0
---------
mistralai/devstral-small-2-2512Q3_K_L13.324.0
1583-03-182026-03-222027-03-212028-03-202029-03-202030-03-192031-03-252032-03-254909-03-10
openai/gpt-oss-20bMXFP412.120.0
1583-04-102026-04-052027-03-282028-04-162029-04-012030-04-212031-04-132032-03-284909-04-14
qwen/qwen3-coder-nextQ4_K_M48.580.0
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.0
---------
qwen/qwen3.5-35b-a3bQ8_037.835.0
---------
zai-org/glm-4.7-flashQ8_031.830.0
---------

Code

Page

Identification
Page ID
Name
Css
Inline

Region

Identification
Sequence
Title
Type
Source
Location
Query Type
Table Name
Order By Clause

Report Column

Identification
Column Name
Type
Heading
Heading

Report Column

Identification
Column Name
Type
Heading
Heading

Report Column

Identification
Column Name
Type
Heading
Heading
Appearance
Format Mask

Report Column

Identification
Column Name
Type
Heading
Heading
Appearance
Format Mask

Report Column

Identification
Column Name
Type
Heading
Heading
Appearance
Format Mask

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

Report Column

Identification
Column Name
Type
Heading
Heading
Column Formatting
HTML Expression

View

View
Name
DDL

Package

Package
Name
Source

Package Body

Package Body
Name
Source