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 8083831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:36:03+00:00 2026-06-05T17:36:03+00:00

Is there any way in Oracle to determine whether a package has state or

  • 0

Is there any way in Oracle to determine whether a package has state or is stateless? I’m not aware of any view in the data dictionary that contains that information.

The “ORA-04068: existing state of packages string has been discarded” error is rather annoying. It can be eliminated by removing package variables from the package. 11g introduced the feature that a package with variables that are all compile-time constants will be treated as stateless.

I could have two sessions and compile the package in one and call it in the other and see if it throws an exception, but that requires calling a procedure in the package, which may not be desirable.

  • 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-06-05T17:36:04+00:00Added an answer on June 5, 2026 at 5:36 pm

    It sounds like what you want is to be able to list all packages that may potentially have state.

    What you’re looking for is just packages that have any global variables or constants. For a single package, this is quite simple by inspection. To look across all packages in a schema, however, you could use PL/Scope:

    First, log in as the schema owner, turn on PL/Scope in your session:

    alter session set plscope_settings='IDENTIFIERS:ALL';
    

    Then, recompile all your package bodies.

    Then, run this query to find all the variables and constants declared at the package level:

    select object_name AS package,
           type,
           name AS variable_name
    from user_identifiers
    where object_type IN ('PACKAGE','PACKAGE BODY')
    and usage = 'DECLARATION'
    and type in ('VARIABLE','CONSTANT')
    and usage_context_id in (
      select usage_id
      from user_identifiers
      where type = 'PACKAGE'
      );
    

    I’d suggest the resulting list of packages will be your target.

    If you’re on 11gR2, constants no longer cause this problem, so you’d use this query instead:

    select object_name AS package,
           type,
           name AS variable_name
    from user_identifiers
    where object_type IN ('PACKAGE','PACKAGE BODY')
    and usage = 'DECLARATION'
    and type = 'VARIABLE'
    and usage_context_id in (
      select usage_id
      from user_identifiers
      where type = 'PACKAGE'
      );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Oracle, is there any way I can execute a query to determine what
is there any way in Oracle, to get only the dd-mm-yyyy part from an
Is there any other way to get datetime field from oracle database in 24hour
Is there any way to view the reduction steps in haskell, i.e trace the
is there any way, to restrict hibernate not to create connection of its own(what
Is there any way to force oracle to use index except Hints?
Is there any way to attach Oracle form Builder with ms access to make
Is there any way to get the Oracle query from PreparedStatement .I know its
Is there any way to move an column in an Oracle table from last
Is there any way to connect OPA to existing data in relational databases (e.g.

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.