DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Data Engineering
  3. Databases
  4. Marking Out-of-Use Methods

Marking Out-of-Use Methods

With Oracle 12c R2, it is now possible to mark a method as deprecated and then notify it when trying to use this method. Learn how to do it.

Emrah Mete user avatar by
Emrah Mete
CORE ·
May. 10, 17 · Tutorial
Like (3)
Save
Tweet
Share
1.95K Views

Join the DZone community and get the full member experience.

Join For Free

The use of "deprecated" methods, one of the warning mechanisms we are accustomed to from high-level programming languages, is now provided with PL/SQL with Oracle 12c R2. It is now possible to mark a method as deprecated and then notify it when trying to use this method.

Let's see how quickly we can handle this.

First of all, in order to be aware of these warnings that the compiler will generate, we open the following warning codes at the session level:

ALTER SESSION SET PLSQL_WARNINGS = 'ENABLE:(6019,6020,6021,6022)';

When we want to compile or call a method that we will mark as deprecated, we have opened the subroutine to give the required compiler warning. Now let's look at how to mark a method as deprecated:

CREATE OR REPLACE PROCEDURE kare_hesapla (x NUMBER)
IS
   PRAGMA deprecate (
    kare_hesapla, 'Bu metod eski. Yeni metod kare_hesapla_yeni.'
  );
   v   NUMBER;
BEGIN
   v := x * x;
END kare_hesapla;
/

As we can see from the sample we made, we reported to the system that the method is an old method with the statement PRAGMA deprecate. We compile our code with a warning system like the one below.

Image title

We marked our sample method as deprecated. Now let's call this method from within another method.

CREATE OR REPLACE PROCEDURE KARE_HESAPLA_2
IS
BEGIN
   KARE_HESAPLA (5);
END KARE_HESAPLA_2;

Image title

After compiling the code we see, the necessary warning messages were shown to us by the compiler. With this mechanism, we can easily alert software developers about the use of our old methods, and we can easily inform them about the use of new methods.

Mark (designation) PL/SQL dev Inform Session (web analytics) Software

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Master Spring Boot 3 With GraalVM Native Image
  • Rust vs Go: Which Is Better?
  • How Elasticsearch Works
  • Monolithic First

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: