DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: how to change the name of all procs?

  1. #1
    Join Date
    Dec 2002
    Posts
    1

    how to change the name of all procs?

    I have about 50 procedures already created in the database . Now I have to add suffix _bak in their names like

    abc
    it shud become abc_bak

    how to achieve this?

    pls.help

  2. #2
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    I don't think there is a command to actually rename a procedure, you will need to write a script which extracts the source of the procedure (DBA_SOURCE) and creates it under a new name.

    Regards
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  3. #3
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588
    Originally posted by jovery
    I don't think there is a command to actually rename a procedure, you will need to write a script which extracts the source of the procedure (DBA_SOURCE) and creates it under a new name.

    Regards
    If you need ready-made script to extract source of the procedure, refer to http://www.quest-pipelines.com/pipel...ves.htm#code19

    HTH

    Sameer

  4. #4
    Join Date
    Aug 2002
    Location
    Atlanta
    Posts
    1,187
    if you are using 9i u could use dbms_metadata to get and change the ddl on the fly. Here is an exmaple on how to get the ddl

    set pagesize 9999
    set long 9999

    SQL> select dbms_metadata.get_ddl('PROCEDURE','MONITOR_INDEXES') from
    dual;

    DBMS_METADATA.GET_DDL('PROCEDURE','MONITOR_INDEXES')
    ----------------------------------------------------------------------
    ----------

    CREATE OR REPLACE PROCEDURE "JADEDEV"."MONITOR_INDEXES" (p_switch VA
    RCHAR)
    AS
    BEGIN

    IF p_switch = 'ON' THEN
    FOR x in (SELECT index_name FROM user_indexes WHERE index_type
    != 'LOB')
    LOOP
    EXECUTE IMMEDIATE 'ALTER INDEX ' || x.index_name || ' MONITORI
    NG USAGE';
    END LOOP;

    ELSIF p_switch = 'OFF' THEN
    FOR x in (SELECT index_name FROM user_indexes)
    LOOP
    EXECUTE IMMEDIATE 'ALTER INDEX ' || x.index_name || ' MONITORI
    NG USAGE';
    END LOOP;



    END IF;

    END;



    SQL>
    I'm stmontgo and I approve of this message

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width