Skip to content
Advertisement

Compiling a function or procedure using JDBC removes all records from all_statements view

After I execute/compile a stored procedure/function, I query the all_statements view to extract the statements that were in the stored procedure/function like below:

JavaScript

However, one of my applications run the following code:

JavaScript

Whenever this code is run, the all_statements view is cleared. Even if I execute this same function like below:

JavaScript

There are no new entries in all_statements showing the statements that were within my MY_FUNCTION function

I need to log into SQL Developer and compile the function manually, for this to start working again.

What is the cause for this?

Any reason for this?

Advertisement

Answer

all_statements is populated by PL/Scope. By default, SQL Developer enables PL/Scope. By default, most other connections do not.

Within your JDBC session, you can enable PL/Scope

JavaScript

If you do so, compiling the procedure will cause all_statements to be populated.

Here is a dbfiddle that shows an example where I create a trivial function, show that neither creating nor compiling it populates all_statements, then enable PL/Scope, recompile it, and all_statements is populated.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement