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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:01:37+00:00 2026-05-23T23:01:37+00:00

I’m working on a project with a lot of plsql code and would like

  • 0

I’m working on a project with a lot of plsql code and would like to add more specific unit-tests to our codebase. Some of the procedures/functions I like to test aren’t in the package spec and I have no means to change that.

Is there a way to access these ‘private’ plsql procedures without adding them to the spec?

The only Idea I had so far, was to compile a special package spec to the DB before the tests, that specifies the procedures under test. I gues that would work, but I wonder if there is a simpler way, some evil secret oracle hack maybe 😉

I’m testing from Java with JUnit/DBUnit.

BR
Frank

  • 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-23T23:01:38+00:00Added an answer on May 23, 2026 at 11:01 pm

    There is a way to do this, providing you are on 10g or higher. It’s called Conditional Compilation. This is a highly neat feature which provides special syntax so we can change our PL/SQL code at compilation time.

    As it happens I have been using this feature precisely to expose private packages in a spec so I can run UTPLSQL tests against them.

    Here is the special syntax:

    create or replace package my_pkg
    as
    
        $IF $$dev_env_test $THEN
    
        PROCEDURE private_proc;
    
        $END
    
        FUNCTION public_function return date;
    
    end my_pkg;
    /
    

    That variable with the double-dollar sign is a Conditional Compilation flag.

    If I describe the package we can only see the public package:

    SQL> desc my_pkg
    FUNCTION PUBLIC_FUNCTION RETURNS DATE
    
    SQL>
    

    Now I set the conditional flag and re-compile the package, and as if by magic …

    SQL> alter session set plsql_ccflags='dev_env_test:true'
      2  /
    
    Session altered.
    
    SQL> alter package my_pkg compile
      2  /
    
    Package altered.
    
    SQL> desc my_pkg
    PROCEDURE PRIVATE_PROC
    FUNCTION PUBLIC_FUNCTION RETURNS DATE
    
    SQL>
    

    Privatising the functions is as simple as you think it would be:

    SQL> alter session set plsql_ccflags='dev_env_test:false'
      2  /
    
    Session altered.
    
    SQL> alter package my_pkg compile
      2  /
    
    Package altered.
    
    SQL> desc my_pkg
    FUNCTION PUBLIC_FUNCTION RETURNS DATE
    
    SQL>
    

    We can do lots more with conditional compilation. It’s covered in the docs. Find out more.

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

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.