New PL/SQL pragma (12cR2) to deprecate program units – sign of a modern programming language

Lucas Jellema
0 0
Read Time:1 Minute, 22 Second

Bryn Llewellyn (Distinguished Product Manager, Database Division, Oracle) presented at OOW2016 on new features in PL/SQL in Oracle Database 12cR2. One of the features that stood out was a new pragma deprecate that can be added to program units such as functions and procedures inside packages. This pragma is used to mark a program unit at deprecated, which typically means: the program unit is still valid, but has been superseded by a better option and no new dependencies should be created on this deprecated unit. In fact, anyone still relying on this deprecated unit should start to consider using its replacement – especially when the code with the dependence is modified anyway for some reason.

Along with the deprecate marker, it is custom to indicate what the replacement is that should be used instead and ideally some indication of how long the deprecated unit will still be around. The pragma deprecate in PL/SQL can have an associated message that provides such information.

It seems that the pragma is part of the implementation of the unit – so resides inside the package body rather than the public specification – but perhaps I am wrong about that. It should be in the specification, as visible as possible.

At compilation time, any dependency from the compiled code on units marked with pragma deprecate will result in compiler warnings. Compilation will succeed, the compiled unit will be valid yet the programmer and/or automated build system are warned and can decide on some course of action.

This slide is taken from Bryn’s presentation:

image

 

The documentation on this mechanism is not available at the time of writing.

About Post Author

Lucas Jellema

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Next Post

Oracle SQL Pattern Recognition - introducing the Match Recognize operator

Oracle Database Release 12c (12.1) introduced a new operator that we can use in SQL queries. The MATCH_RECOGNIZE operator allows us to detect patterns in our relational data. Specifically: it allows us to identify records that mark the beginning of a set of records that together form a pattern. In […]
%d bloggers like this: