Synonyms for packaged procedures

Heres something that is currently bothering me.
Why are we not allowed to create synonyms for procedures and functions within packages ?
Our database has too many individual procedures and functions for my liking and I would like to move some of them into packages. Consequently I want to create synonyms to avoid changing application code.
I have found metalink note 1061643.6 which confirms this cannot be done, but it also goes on to say:
"Oracle does this using the STANDARD package with overloaded functions and procedures such as TO_CHAR() and TO_DATE(), but how Oracle does this is proprietary information and is not available to the public."
(Thanks Oracle)

The basic reason for this restriction is that the Oracle synonyms are alternative names only for database objects, not for PL/SQL objects like packaged function and procedures.
But moving stored procedures/functions to packages is a good idea, recommended by all the experts, with many benefits for you in the future.
There is a simple solution for you problem, with very little impact on the continuity or performance of your applications:
1. Copy the code of the DB stored procedures and functions to PL/SQL packages, mirroring them into packages subprograms.
2. Replace the body of the DB procedures and functions with plain calls to their packages equivalents, transforming them effectively into wrappers behaving like synonyms.
3. Change gradually the code of the application to call directly the packages functions and procedures
4. When the change is completed, delete the wrappers.
BTW If Oracle does not support a feature, than you it's better not to use it. Modifying the STANDARD package or using some volatile, undocumented features is not a clever move...

Similar Messages

  • Privilages for Package.procedure

    Hi all,
    can any one plzz help me out how to grant privilages for package.procedure.
    I had given grant execute on Package but its not working out.
    Thanks in Advance

    <FONT FACE="Arial" size=2 color="2D0000">
    The reason may be
    ORA-00942:     table or view does not exist
         ORA-06512: at line <number> ? check in that line number
       * the spelling of the table or view name.
        * that a view is not specified where a table is required.
        * that an existing table or view name exists.
      -SK
    Edited : See to that table/view used in the packages can be accessed by  granted user
    </FONT>

  • Synonym for Package?

    Is it a standard practice to create PUBLIC SYNONYMS for Packages? Like
    CREATE PUBLIC SYNONYM <synonym_for_package> FOR <package_name>;

    Is it a standard practice to create PUBLIC SYNONYMS
    for Packages? Like
    CREATE PUBLIC SYNONYM <synonym_for_package>
    FOR <package_name>;The practice is to create synonyms for database objects on other schemas where you want to reference them locally without having to specify the schema name. It's not specific to packages.
    If there's no need to create the synonym then don't do it.

  • How to find the grants given to user for package/procedure?

    Hi all,
    how to find the grants in oracle for what all are the grants a user is having for package and procedure?
    Thanks & Regards,
    M.Murali..

    M. Murali
    Questions like this are asked over and over again on numerous sites on the Internet, including this forum, and answered.
    You are aware this forum has a 'Search Forum' button?
    PLEASE USE IT and STOP asking FAQ and DOC questions!!!!!!!!!!!!!!!!!!!
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read the documentation

  • Idea for package/procedure/function distribution ??

    Hi all
    We have multilple databases (10.2.0.3). And we have a lot of "utility" packages for both appl. util and for DBA utils.
    We have created a XXXUTIL schema on each database.
    How do we keep those schemas in sync automatically - apart from doing export/import? We will name on "master" and all other should be in sync with this one schema (packages/procedures/functions/views)
    Is there a smarter way of doing this, a pull or push replication solotiuon. We are on the 10g Enterprise verison.
    Ideas appreciated
    best regards
    Mette

    Hi,
    As you said you got a lot of utility Packages, I think you can directly compile those scripts one you changed in the master DB, there won't be any thing to Sync the Procedures from One DB to another DB.
    If it is a data then, you might gone for DB Link, Streams etc., for replicating the data.
    In order to automate your need to write a script for logging into DB and running set of scripts and disconnecting - a shell script.
    Just think is that your requirement.!!
    Pavan Kumar N

  • Browser bug for package procedure named "delete"

    One should not use a reserved word when naming stored procedures, but while Oracle allows one to create a packaged procedure or function named "delete" (at least in 9.2 through 11.2), an object so named prevents the object browser and outline window from properly displaying all procedure and function names.
    Test case:
    CREATE OR REPLACE PACKAGE my_pk
    AS
    PROCEDURE delete;
    PROCEDURE p;
    END my_pk;
    The object browser shows the word "PROCEDURE" but not any of the procedure names.
    - Doug

    Hi Doug,
    Thanks for reporting this issue. I logged a bug for it:
    Bug 14474608 - FORUM - USING DELETE AS PACKAGE PROCEDURE NAME, NAV TREE RENDERS IMPROPERLY
    Also note that using something like "PROCEDURE delete(key NUMBER);" prevents any member nodes from showing in the package's tree. Many other "reserved words" like select, create, insert result in compilation failure in both SQL*Plus and SQL Developer, but apparently your case should work.
    Regards.
    Gary

  • DB Link for packages/procedures

    Hello,
    Can I use use a dblink to invoke a procedure? If yes is it same same as workibg with a table using dblink?
    Thanks,
    NAG

    Hello Robert,
    It sounds exciting. Can you telll me the syntax for Pro*C. because I have people who are trying to do the same using Delphi and I believe what works for Pro*C should work for Delphi as well.
    Please do let me know.
    Thanks,
    Nandu

  • How to find out Unused Packages/Procedures/Functions/Triggers

    Hi,
    I have one database. This database is with 7 schemas. Around 1000 triggers are associated with each schema. But the application is using only some triggers.
    How to find out the used triggers? Apllications is developed in J2EE.
    Same way I want to find out the for Packages/Procedures and Functions.
    Any easy way is available?
    Please help me.
    regards
    Mathew

    Hi,
    >Audit the execution event on the objects by access.
    Kindly explain how to enable this auditing.
    regards
    Mathew

  • Create filter for Prcing Procedure in Business Object

    in the intial Download, I need to download Pricing procedure from r/3. but I need to give criteria, which are the tables i need to give criteria.
       in intial dowload it overwrites the data or append?
    Please give the information asap.

    Hi,
    i'm coming from z/OS and there it is not allowed to create a synonym for a procedure, only tables or views:
    >-CREATE SYNONYMsynonym--
    >FORauthorization-name.--table-name-----
    >
    >......................................... '-view-name--'                                                                               
    Looking around in the IBM infocenter for LUW i didn't find any syntax diagram.
    regards
    Kay

  • Serialized access for package compilation

    hi all,
    Especially for development environments i strongly need a concurrency mechanism for package, procedure, function, trigger compilation. I want to lock package, so that no one else can compile while i hold that lock. This will provide serialized access.
    Mostly developers use same database user for development, so grant will not do what i want. I assume there has to be a custom solution, ie using dbms_lock.
    Any help will be appreciated.

    Goman how are you, world is so little these days :)
    check these out, I hope they assist you -
    Is it Possible to lock a Package
    http://psoug.org/reference/dbms_lock.html
    http://asktom.oracle.com/pls/asktom/f?p=100:11:1044585173011869::::P11_QUESTION_ID:340617419132

  • How to know (package , procedures or functions) name for current sessions

    Hi all
    I'm DBA and i want to find way to get object name whatever (package , procedures or functions) for current running statement in active session.
    To clarify when i open session browser from toad i can see active sessions and see current statement for every session but without the name of the object.
    Is there any way to know this point.
    thanks in advance

    select *
      from dba_objects
    where object_id in (select nvl(t.PLSQL_ENTRY_OBJECT_ID,-1)
                           from v$session t
                          where sid = 452)
    Ramin Hashimzade

  • How to check performance for Stored procedure or Package.

    Hi ,
    Can any one please tell me , how to check performance for Stored procedure or Function or Package
    Thanks&Regards,
    Sanjeev.

    user13483989 wrote:
    Hi ,
    Can any one please tell me , how to check performance for Stored procedure or Function or Package
    Thanks&Regards,
    Sanjeev.Oracle has provided set of Tools to monitor the Performance.
    Profilers being one of them; If you wish to understand more on PL/SQL Optimization, please read PL/SQL Optimization and Tuning.
    See example of DBMS_PROFILER.
    See example of PLSQL Hierarchial Profiler

  • Counting the number of lines for each procedure in a package

    Hi,
    I would like to write a query on USER_SOURCE that can display the number of code lines for each procedure/function in a package.
    Is it possible to write such a query? Maybe by using analytical functions?
    for example in the following example i would like to count the lines between "PROCEDURE proc1 IS" and "END proc1;" and between "PROCEDURE proc2 IS" and "END proc2;"
    SQL> select text  from user_source where name='PKG_TEST' and type='PACKAGE BODY';
    TEXT
    PACKAGE BODY PKG_TEST IS
      PROCEDURE proc1 IS
      BEGIN
        update t1 set EDITION_NAME = 'AAAAAAA';
        commit;
      END proc1;
    PROCEDURE proc2 IS
      BEGIN
       update t1 set EDITION_NAME = 'AAAAAAA';
        commit;
      END proc2;
    END PKG_TEST;thanks for helping

    onedbguru wrote:
    Hopefully some idiot manager isn't trying to use this sort of thing to base their decisions on developer productivity. If so, they ARE idiots. Number of code lines NEVER, EVER, EVER!!! translates into an efficient application. If I were paid by the line, my code would look like:
    select
    1
    from
    dual
    Based on the idiocy of this method of determining "performance" I would get paid $5.00 at $1.00/line. And trust me, I saw this back in the 80's and 90's and saw similar idiotic code and had to clean up the mess. Most of it wasn't efficient code to start with let alone the number of lines generated.Or the other extreme, when the PHB firmly believed that execution efficiency was gained by reducing the number of lines of code. So instead of nicely formatted, easy to read code:
          *GET NEXT ORDER NUMBER                                                               
                EXEC SQL                                                                        
                     SELECT (MAX(ORDER_NUM) + 1)                                                
                     INTO   :NEXT-NUM:IND-NULL                                                  
                     FROM   PART_ORDER                                                          
                END-EXEC.                                                                       
                IF IND-NULL < 0                                                                 
                  MOVE 1 TO NEXT-NUM.                                                           
                EXEC SQL                                                                        
                     INSERT                                                                     
                     INTO    PART_ORDER                                                         
                            (ORDER_NUM,                                                         
                             ORIGIN_LOC,                                                        
                             ORDER_TYPE,                                                        
                             ORDER_STAT,                                                        
                             CREAT_TIME)                                                        
                     VALUES (:NEXT-NUM,                                                         
                             :LOC, 'R', 'O',                                                    
                             CURRENT TIMESTAMP)                                                 
                   END-EXEC.                                                                    
                MOVE NEXT-NUM TO MASK0.                                                         
                PERFORM HEADER-PROC THRU HEADER-EXIT.                                           
            CREATE-ORDER-EXIT. EXIT.                                                     You got this:
           *GET NEXT ORDER NUMBER
            EXEC SQL SELECT (MAX(ORDER_NUM) + 1) INTO :NEXT-NUM:IND-NULL FROM
            PART_ORDER END-EXEC. IF IND-NULL < 0 MOVE 1 TO NEXT-NUM. EXEC SQL INSERT
            INTO PART_ORDER (ORDER_NUM, ORIGIN_LOC, ORDER_TYPE, ORDER_STAT,
            CREAT_TIME) VALUES (:NEXT-NUM, :LOC, 'R', 'O', CURRENT TIMESTAMP)
            END-EXEC. MOVE NEXT-NUM TO MASK0. PERFORM HEADER-PROC THRU HEADER-EXIT.
            CREATE-ORDER-EXIT. EXIT.                 Oh, wait! See the same thing all the time in this forum ... not because someone thinks fewer lines = faster code, but simply because people are sloppy.
    INSERT INTO PART_ORDER(ORDER_NUM,ORIGIN_LOC,ORDER_TYPE,ORDER_STAT,CREAT_TIME) VALUES (:NEXT-NUM,:LOC, 'R', 'O',CURRENT TIMESTAMP) ;

  • How to execute the packaged procedure(having out param) in TOAD for Oracle

    Hi.
    Could you help me
    How to execute the packaged procedure having out parameters in TOAD for Oralce..
    Thanks..

    Use anonymous PL/SQL block to execute it.
    Example.
    DECLARE
      <out variable name> <out variable data type>;
    BEGIN
      <package name>.<procedure name>(<out variable name>);
    END;

  • How to declare synonym for a package function with a DBLink

    Hi,
    I have a PL/SQL package 'pkg'
    and a function in the package 'func'
    at another db using a dblink.
    How to I create the correct syntax to create the synonym for this package and function.
    create synonym --- for ---@dblink
    Thanks.

    CREATE SYNONYM <name> FOR <OWNER>.<OBJECT>@<DB_LINK>
    {code}
    the object in this case would be pkg.func
    Edited by: Tyson Jouglet on Sep 25, 2008 5:12 PM                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • ITunes 10.5 will not download

    HELP iTunes 10.5 will not download, it asks me if I want to download....I click "Download Now" then nothings happens. Please help me that is not a link. its my question

  • Animation logic doesn't make sense....

    I know this probably should go to a suggestion/feature request or what not but A. I haven't been able to find the place for that and B. I felt like it'd make sense to see what others thought of this as well.... Firstly....I'm learning flash right now

  • Problems with sun update connection server ?

    recently I've been having problems with accessing the update connection web server. Can't get in with Firefox sometimes - get blank pages, or 401 error pages. Then today with IE, hitting the help page on the top right, I get: Sun ONE Application Serv

  • Photo link to open or save as?

    How do I setup an image of a photo as a link to show the open or save as box when clicked on?  When I click on it, it just open in a new browser window.  When I put a powerpoint file link it will work. This is what I want it to do.  See attachment. T

  • TS1717 I can't access Itunes, Please assist.

    The itunes library.itl file is locked, on a locked disc, or you do not have write permission for this file. How can I reslove this? I recently took my Desktop to Best Buy so it can be wiped of viruses.