May
10
Written by:
StevenFeuersteinTW
Monday, May 10, 2010 6:09 AM
I recently received this question from a PL/SQL developer:
"What is the maximum size of a PL/SQL procedure?"
The answer is interesting: there is not a maximum size, per se. Instead, the limitation has to do with the maximum number of DIANA nodes your program generates in the compilation process.
DIANA is an intermediate language produced and used by the compiler. DIANA standards for “Descriptive Intermediate Attributed Notation for Ada" - and reminds us that PL/SQL is based on Ada, a programming language originally developed for the U.S. Department of Defense.
DIANA code is in the form of a tree structure, and nodes in the tree correspond to tokens in your programs, which include identifiers, keywords and operators.
So here's the actual limitation regarding "size" (quoting now from the Oracle documentation): "a package spec, object type spec, standalone subprogram, or anonymous block is limited to 67108864 (2**26) DIANA nodes....[which] allows for ~6,000,000 lines of code."
In other words, you really should not have to worry about "running out of space" when building your PL/SQL program units.
You will run up against maintainability issues way before you run into PL/SQL limitations. If your program unit is getting big enough that you are even wondering if it is too big, you should break it up into smaller units, with different names and distinct purposes.
1 comment(s) so far...
Re: How big can my program get?
It happened to me 'ages ago', I think it was either Oracle 6 or 8
I had PL*SQL modules with ~ 1500 lines (don't ask why).
Then I reached a point where the procedure just wouldn't compile. No error message, nothing... I somehow found out, that the size of the procedure was the reason.
After splitting the procedure into smaller packages it worked again
Hopefully Oracle nowadays gives a decent error message ;-)
By SStippler on
Tuesday, June 15, 2010 5:47 AM
|