Which are, if any, the advantages of calling a
PL/SQL package procedure through a TOracleCustomPackage compared to using a
PL/SQL block inside a TOracleQuery or Dataset?
Advantages
Using the Package Wizard has many advantages over the use of TOracleQuery or TOraclePackage components. Some of these advantages are obvious, and some will occur to you as you use the generated packages:
No need to create and maintain components to call the packaged program units. You can simply generate and regenerate your packages with the Package Wizard. This will be a tremendous time-saver.
Delphi and C++Builder's code completion will of course work for the packages. Have you forgot the name of a program unit or parameter? Have you forgot if a parameter is input and/or output? You can now find this information as easily as you would find information about other Delphi or C++Builder classes.
As you don't access any function, procedure or parameter by name, you can't possibly make a mistake that wouldn't be reported at compile-time. If it can compile it can run. For the TOracleQuery or TOraclePackage approach you would find these errors at run-time.
The Package Wizard will generate classes that encapsulate PL/SQL Record types. Program units that have record type parameters can now be used as easy as any other program unit.
The Package Wizard makes use of a special class that encapslates scalar PL/SQL table types, which makes these parameter types easier to use.
In Delphi or C++Builder 4 and later, you will see overloaded program units just like they are.
If you put some form of documentation into your Package Specifications, then you can see this information in the generated classes. If you are using the packages as components, the package specification is visible as a read-only PackageSpecification property.
Calls to packaged functions and procedures are automatically thread safe without the need to explicitly program critical sections. This means that you can call a single package instance from multiple threads simultaneously.
Because the package classes are generated into separate units, you can automatically reuse them in multiple projects.
It's fun to generate code and to show your boss that you have 'produced' thousands of lines of code in just 1 day.