A story about APEX Debug's advice on Deprecated Features

A story about APEX Debug's advice on Deprecated Features

Β·

4 min read

I made a small discovery whilst looking a the Customers Starter Application and decided to share some thoughts.

Here we go... I have a piece of code that checks the build option status.

No big deal, it works fine.

  • The page displays

  • No errors in the console

  • No red triangle in the developer bar

  • No rows in Monitor Activity \ Application Errors

It all looks good.. it works as intended, I get the build option status as I wanted.

Run it in debug mode though and we get a giant satsuma 🍊 on our chart! this is telling me that the page has encountered a problem!

When you click on that satsuma 🍊, you see that there is actually a problem

So this is logging at Level 2. The default APEX debug level is Level 4, so this is why this message is being hoovered up on our chart.

By the way, a Level 1 is an error. For example this divide-by-zero error.

Run that, and for sure, you'll see a Level 1 inside a bunch of red text.

Level 1's also appear on the Monitor Activity \ Application Errors report

So its a good idea to review that report from time to time.

But what actually happening to our build option code though?

  • It appears that we used apex_util.get_build_option_status but it is in fact deprecated and the documentation says it will be removed in a future release.

  • I'm actually really pleased that APEX Debug has gone the extra to advise me. The advice of an alternative function is really good to see.

  • I like that this Level 2 makes a satsuma, drawing my attention to it, without creating an application error.

Since there are 32 deprecated procedures/functions in APEX 23.2. Lets' test them all to see if they all behave like this πŸ‘

First one up. In alphabetical order, is: apex_background_process.abort Signature 1 (Deprecated).

This procedure is related to aborting a running process on a background chain. If you are unfamiliar with this, have a look at the picture below. I'm creating a PL/SQL that runs for 10mins and there is a background chain to push it to a DB scheduled job.

I kick it off and fire up Session > Background Executions and find my job with ID 127017

There's a few annoying things about the page above.

  • It doesn't tick all the check-boxes by default, so you cant see any completed processes unless you tick 3 boxes and click go.

  • It doesn't show the execution ID (required for aborting in Signature 2)

  • It only shows the ID, which if you use your imagination a bit, is really close to the debug ID a few pictures above. This is because, really, it is a debug ID 🀯

Lets try to abort it in PL/SQL

Wait... What? It couldn't find the process to abort?

OK. so after a bit a faffing about. I discovered the APEX team has wired up Signature 1 and Signature 2 in the wrong order!

  • Signature 1 accepts a process id, but its actually the execution id

  • Signature 2 accepts a execution id, but its actually the process id

I bet that's why its deprecated 😁

Err. what should we do? I can't start alphabetically on Signature 2 πŸ€·πŸ»β€β™‚οΈ So lets find the execution ID and feed it in to Signature 1.

I added a Classic Report on the APEX_APPLICATION_PAGE_PROC view to find the execution ID.

Found it! It's 286401835177348210

Lets try to abort it, this time passing the execution id in to the parameter named p_process_id.

Yippee! we terminated it using the deprecated procedure.

So lets look at the debug now and hopefully we'll get a scolding for using a deprecated feature. Once debug educates us on an alternative measure, we can take proactive steps to resolve it.

Wait... no Level 2 error? no wall of red text? no satsuma? no advice about using an alternate procedure?

Oh no. I was looking forward to my scolding.

Fear not, there's 32 deprecated procedures/functions in the APEX 23.2 documentation. We've tried 2 of them ... lets try out the remaining 30 and see which ones advise and which ones do not. Bah, no. I've better things to do....

Moral of the story: Although its nice when you see it, don't rely on the APEX debug to tell you if you are using a deprecated feature. You have to make proactive steps to resolve it.

It sounds like a job for the Adviser anyway, as this told me about other issues, but not apex_background_process.abort.

Lets see if what road-mapped Idea FR-2233 brings in a future release.

There appears to be two levels of deprecated features from what I see from the documentation. Usually they come with some advice with an alternative to use.

Hope you enjoyed this story

Whats the picture? Spring in Harrogate, UK

Β