Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 507421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:48:09+00:00 2026-05-13T06:48:09+00:00

I have discovered recently that’s possible to call anoymous blocks from jdbc like this:

  • 0

I have discovered recently that’s possible to call anoymous blocks from jdbc like this:

    String plsql = "BEGIN" +
                   " :result := foobar( booleanparameter => :mypar > 2);" +
                   "END;";

    con.prepareCall(plsql);

Which is great, because I can use this to “wrap” some function calls and
overcome some jdbc limitations. For example, I can’t pass boolean vars to
pl/sql procedures, and can’t change the procedures signature since there is
lots of code which depends on them. Adding new “wrapping” procedures isn’t easy too
because of internal policy reasons.

So it’s seems like an acceptable solution, but, I’m concerned about parsing
overhead. Are anonymous blocks like this stored parsed in the SGA or are they
parsed every time they are called?

Thanks

Update 1: I have made a quick beanshell script to look into v$sqlarea as egorius suggests:

String  plsql = "BEGIN :myresult := dbms_random.random ; END;";
OracleDriver oracledrv = new OracleDriver();
Connection   con = oracledrv.connect(connstr, new Properties());

for (int i = 0 ; i < 1000 ; i++ ) {
    CallableStatement cb = con.prepareCall(plsql);
    cb.registerOutParameter("myresult", Types.INTEGER);
    cb.execute();
    System.out.println("random ->" +cb.getInt("myresult"));
    cb.close();
}
con.close();

And this is what I get int v$sqlarea (I have run it twice):

SQL_TEXT
--------------------------------------------------------------------------------

PARSE_CALLS EXECUTIONS
----------- ----------
BEGIN :myresult := dbms_random.random ; END;
       2000       2000

Does this mean that is preparsed or not?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:48:10+00:00Added an answer on May 13, 2026 at 6:48 am

    Anonymous blocks are cached as well. You can check it by querying V$SQLAREA.

    SQL> declare abcabc number; begin null; end;
    2 /

    PL/SQL procedure successfully completed.

    SQL> /

    PL/SQL procedure successfully completed.

    SQL> select sql_text, executions from v$sqlarea where sql_text like ‘%abcabc%’;

    SQL_TEXT
    ——————————————————————————–
    EXECUTIONS
    ———-
    declare abcabc number; begin null; end;
    2

    select sql_text, executions from v$sqlarea where sql_text like ‘%abcabc%’
    1

    EDIT:

    You’ll always have what is called SOFT PARSE. It’s needed for syntax and semantic check of a query. After that, if exactly the same query exists in library cache, HARD PARSE will be skipped. (See this Ask Tom question for a good explanation).

    Here is excerpt from tkprofed 10046 trace file:

    declare abcabc number; begin null; end;
    
    call     count       cpu    elapsed       disk      query    current        rows  
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        2      0.00       0.00          0          0          0           0
    Execute      2      0.00       0.00          0          0          0           2
    Fetch        0      0.00       0.00          0          0          0           0  
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        4      0.00       0.00          0          0          0           2
    
    Misses in library cache during parse: 1
    

    The last line shows the point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html Well, at
I recently discovered that when you have a page set to session readonly and
I recently discovered that all Windows 7 machines have an handwriting recognition API within
I have discovered that it is possible to populate resource strings with variable information
I have recently discovered that my ScrollPane class code hinting is completely missing. Nevertheless,
I've recently discovered that MVC is supposed to have two different flavors, model one
Recently I have discovered that my release executable (made with msvc++ express 2008) becomes
I recently have discovered a warning happening in Firefox that says Warning: Unknown pseudo-class
I have a rather large DBML file and recently discovered that Visual Studio's MSLinqToSQLGenerator
We have recently discovered that when we run a lot of different processes on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.