String panipulation - rename the package name in the source code.

I want to do the replacement string as below:
select 'CREATE OR REPLACE PACKAGE CollectStats IS
  PROCEDURE save_log(p_logrec IN LiveStatsLog%ROWTYPE);
  PROCEDURE UpdateLiveGamesHourlyStats;
  PROCEDURE UpdateSideGamesHourlyStats;
  PROCEDURE UpdateConcurrentPlayerStats;
  PROCEDURE CollectStats;
END CollectStats;' from dual;

-->

select 'CREATE OR REPLACE PACKAGE CollectStats_20100810 IS
  PROCEDURE save_log(p_logrec IN LiveStatsLog%ROWTYPE);
  PROCEDURE UpdateLiveGamesHourlyStats;
  PROCEDURE UpdateSideGamesHourlyStats;
  PROCEDURE UpdateConcurrentPlayerStats;
  PROCEDURE CollectStats;
END CollectStats_20100810;' from dual;
The point is to rename the name of the package in the Package source code, in the first and the last line of the source code.
This is only an example package. The query must sort the replacement of the chain so that the result would be, as shown in a package with a different name.
Note that name of the package, and a procedure within the source code of the package are the same - see "PROCÉDURE CollectStats;".

Somehow the replacement of the regular expression should be used.

Published by: CharlesRoos on August 11, 2010 03:31

Try this:

SQL> ed
Wrote file afiedt.buf

  1  with t as (select 'CREATE OR REPLACE PACKAGE BODY "XXX"."COLLECTSTATS" IS....
  2  PROCEDURE CollectStats IS
  3    BEGIN
  4      UpdateLiveGamesHourlyStats;
  5     UpdateSideGamesHourlyStats;
  6      UpdateConcurrentPlayerStats;
  7    END CollectStats;
  8  END CollectStats;
  9  /' body from dual)
 10  SELECT REPLACE(REPLACE(body,'BODY "XXX"."COLLECTSTATS"','BODY "XXX"."COLLECTSTATS_20100811"'),
 11         'END CollectStats;'||CHR(10)||'/','END CollectStats_20100811;'||CHR(10)||'/') body
 12* from t
SQL> /

BODY
----------------------------------------------------------------------------------------------------
CREATE OR REPLACE PACKAGE BODY "XXX"."COLLECTSTATS_20100811" IS....
PROCEDURE CollectStats IS
  BEGIN
    UpdateLiveGamesHourlyStats;
        UpdateSideGamesHourlyStats;
    UpdateConcurrentPlayerStats;
  END CollectStats;
END CollectStats_20100811;
/

SQL> 

Tags: Database

Similar Questions

  • Where can I see the source code for the controller

    Hi all

    My question is maybe stupid to some gurus of the ADF, but many people have found that R12 Pages have a lot of code and there is not too much documentation on how to customize a controller.

    1. I see the *.class of my controller in the $JAVA_TOP/oracle/apps/ar/cusstd/createcus/webui/ArCreCusCO.class on my server, BUT I don't see that any of the encrypted code when I open up JDeveloper. So I guess I'm doing it wrong.

    2. I want to change ArCreCusCO.class. I see a lot of people say Hey I've customized XYZ controller, but how they found the code and continue to change it is the least of my headaches

    3. do I need to configure something in JDeveloper so I can see Server classes to my JDeveloper - what they do, if so, how you do?

    4. I saw something in the help page saying adding components to the Extension of the OA the devil what?

    Thanks to illuminate some beginners in the ADF.

    With the new philosophy of Java, some of those 12 developers experience that we are not starting from zero because of this new architecture.

    Hector. -.

    p.s. any entry will be taken, but do not refer to the Oracle tutorial, is an example of cake I need some practical examples ;-)

    Hi hbono99

    (1.) you can .class c above java, which is the compiled code as source code is not provided by oracle, if you need this file '.class' to see the source code for decompile, JAD decompiler 1.5.8 version will be newer .well, it would be useful to see the source code, but sometimes decompiled class create problems when trying to compile again.

    2.), you can make changes in the ArCreCusCO.class after that decompilation and compile the same thing again to generate the class file, bcz you can put only class file on the server, BUT that would be fatal to change the standard class and the concept here to come of the Extension in the image, you need to extend this class. «XYZ custom "means the extesión of the class parent and make the extension u don't need not the source.»

    3.) u cannot see the source code of a .class in Jdeveloper, there is no such a parameter.

    (4.) to extend the need to ArCreCusCO.class you to create a workspace followed by creating a project in the workspace Jdeveloper
    process to extend the class

    a.) create workspace and project
    (b) create the same package in which resides the ArCreCusCO.class under the \jdev\myprojects\ in your Jdeveloper
    (c.) right click on the project, go to create the new class, here you will find the option to metion the package where you want to put the superior (normal package starts with a xx.oracle.-) the possibility of mentioning the nmae classs that you want to extend
    (d.) click ok at the end, you will get your extended class

    e.) source code usually has two methods ProcessFormRequest and processRequest, you can add the code according to the requirement.

    extension works bcz inside the method she calls super, so all first it runs all the methods of the parent class in your case ArCreCusCO.class and then control comes in extended class, now, your code will be run, which will be accomliseh your condition

    f.) tranaser the class file file expanded to the server, add this extended class with seeded page you need to customize the page, you will find the option to add your class, mention u your class with package to compete (the way that we import the file with their package names in our source code, here import is not necessary)

    thanx

    Pratap

  • Rename the source of names clip?

    In FCP7, there is a very handy feature that allows you to rename the source file to match the name of the element.

    Screen shot 2011-11-02 at 11.14.04 AM.png

    This is extremely useful when you rename clips to be more appropriate/description of a project and you want to change the name of the source to match.

    Is there anyway to do something similar to the first Pro CS5.5 or you must rename each element source manually, then reconnect?

    Well... not really (but somehow). But there is a good reason why you don't want to do. Where FCP only works with QuickTime files where to rename source files to match the clip names is harmless, Premiere Pro works with a wide variety of native formats, including tapeless formats that require the naming of specific files and folders structures. If you have renamed the source file to match the clip names, formats may become unreadable by many devices and applications. Our concept is to 'do no harm '.

    However... If you want to consolidate and rename your source files to match the names of your clip (this is the part "kind of"), you can do so via the project manager (project > Project Manager).  Simply select the option 'Rename files to Match Clip names of media' when you cut your project. The reason why this option is available here, without you worry about corrupting your tapeless media structures is that Premiere Pro makes new copies of the multimedia files and puts them in a new location. In this way the original media remains intact and is not harmed. Premiere Pro can still access and open these files, since it requires structures of specific folders and naming conventions to import the files. Other applications and devices that need these structures of folders and naming conventions can always access the original source media that they were created from.

  • Get the source code of a procedure for a huge package in oracle

    I have a package which, as methods of 40-50 in them, I would like to retrieve the source of one inside the package. is there a table where I can get this detail in the oracle database.


    I know there is an all_source table, which has the entire source code, but I want to only get the source code for a particular procedure.

    Thanks in advance.

    You have defined your procedure as provided

    procedure procedure_name...
    ...
    end procedure_name;
    

    and the procedure is not overloaded, you can try something as

    with
    first_line as
    (select line
       from all_source
      where instr(lower(text),'procedure '||lower(:procedure_name)) > 0
        and name = :package_name
        and type = 'PACKAGE BODY'
        and owner = :package_owner
    ),
    last_line as
    (select line
       from all_source
      where instr(lower(text),'end '||lower(:procedure_name)||';') > 0
        and name = :package_name
        and type = 'PACKAGE BODY'
        and owner = :package_owner
    ),
    select text
      from all_source
     where line between (select line from first_line)
                    and (select line from last_line)
     order by line
    

    Concerning

    Etbin

  • How to find the source code (package / service..) a concurrent program

    Hello


    I gives me the name of a concurrent program.

    Now my question is, how do I find the source code for the simultaneous progra.


    Could someone explain to me.

    FYI: I have full access (sysadmin).

    Thank you
    Prasad
    Senior Oracle Apps DBA

    PL post Details of the operating system, database and versions EBS.

    Responsibility of the system administrator, go to the competitor > program > set and search for the name of your simultaneous program. When you find it, there will be a 'the executable name' that are associated with him.

    Go to the competitor > program > executable and locate the 'name of the executable"- and you will get the information you need.

    http://docs.Oracle.com/CD/E18727_01/doc.121/e12897/T302934T458253.htm

    HTH
    Srini

  • Enter the source code before and after recompilation/crush

    Hello

    I am trying to store the source code of a program unit in a table before and after the source code "changed". I tried to do it with a BEFORE and AFTER the level scheme of UPDATE trigger, respectively, what fire for a CREATE event - both use the DBMS_METADATA. Routine GET_DDL to generate the code. The problem is that the source code that is returned by dbms_metadata.get_ddl in both triggers will return the code prior to the change, rather than after the change. Can anyone suggest how I could manage to capture the most recent/changed version of source code.

    Kind regards

    Kevin.

    CREATE OR REPLACE

    CODE_BEFORE RELAXATION

    BEFORE YOU CREATE

    WE DATABASE

    DECLARE

    CURSOR v_cur

    IS

    SELECT TEXT

    OF DBA_SOURCE

    WHERE OWNER = ora_dict_obj_owner

    AND NAME = ora_dict_obj_name

    AND TYPE = ora_dict_obj_type

    ONLINE ORDERING;

    BEGIN

    IF ora_dict_obj_type () IN

    'PROCEDURE ',.

    "FUNCTION."

    'PACKAGE ',.

    'PACKAGE BODY '.

    )

    THEN

    dbms_output.put_line ('= CODE BEFORE =');

    FOR v_rec IN v_cur LOOP

    dbms_output.put_line (v_rec. (Text);

    END LOOP;

    END IF;

    END;

    /

    CREATE OR REPLACE

    CODE_AFTER RELAXATION

    AFTER CREATE

    WE DATABASE

    DECLARE

    v_sql_text ora_name_list_t;

    V_I int;

    v_stmt CLOB.

    BEGIN

    IF ora_dict_obj_type () IN

    'PROCEDURE ',.

    "FUNCTION."

    'PACKAGE ',.

    'PACKAGE BODY '.

    )

    THEN

    V_I: = ora_sql_txt (v_sql_text);

    dbms_output.put_line ('= CODE AFTER =');

    I'm IN 1.v_i LOOP

    dbms_output.put_line (v_sql_text (i));

    v_stmt: = v_stmt | v_sql_text (i);

    END LOOP;

    END IF;

    END;

    /

    Now:

    SQL > set serveroutput on
    SQL > create or replace
    2 procedure p1
    3 is
    4 start
    5 dbms_output.put_line('original');
    6 end;
    7.
    = THE CODE FRONT =.
    = CODE AFTER =.
    create or replace
    procedure p1
    is
    Start
    dbms_o
    UTPUT.put_line ('original');
    end;

    Created procedure.

    SQL > create or replace
    2 procedure p1
    3 is
    4 start
    5 dbms_output.put_line('modified');
    6 end;
    7.
    = THE CODE FRONT =.
    procedure p1

    is

    Start

    dbms_output.put_line ('original');

    end;
    = CODE AFTER =.
    create or replace
    procedure p1
    is
    Start
    dbms_o
    UTPUT.put_line ('modified');
    end;

    Created procedure.

    SQL >

    SY.

  • You try to view the source code

    Do not show my source code. I'm going to view-> page source isn't there? I get only the toolbars, side bar, zoom, style page, coding of characters, full screen. Is there another way to find the source code? Why not to come page source? Any help would be appreciated! Thnx!

    They moved and renamed some menu items.

    • Use Tools-> Web Developer-> ( OR use Ctrl + U keyboard)
  • Why can't get us the source code Freelancer?

    I understand that this is probably the wrong way to go, but since I don't know any other way, so this seems the best solution currently.

    Freelancer is a 2003 game who appreciated the merits of a hosted Microsoft 'global server' for many years. This support has been removed for more than a year, have been longer. Since then, she has in fact the players, or the community of developers, which has instead created a way not no need for this global server, while keeping the same features in the game.

    Currently there is a community of developers very involved in the game, even with it's player-base down. However, while much can be done as it is, many changes to the game requires things such as to modify the main .exe of the game, goes against the General conditions and so possibly illegal. However, Microsoft has not taken action against such a thing. The only real penalty the Freelancer community met in his history of editing has been a debacle involving a modification on the Halo theme.

    So while Microsoft has essentially removed the bulk of its support for the game, he also did nothing to stop his change, something that many are grateful.

    Ultimately, however, there are many parts of the game that most wish could be changed, but can never be the nature 'hard-coded' of such a thing, where the key to change he is locked up somewhere that we either do not have the knowledge and the ability to get to.

    There has been a lot of requests for the Source Code of Freelancer, but none have materialized. I understand that this is due to a policy that it does not give the source of his games or that the questions should be directed to the developer instead maybe Microsoft. The latter is impossible because the developer was bought by Microsoft, and subsequently dissolved.

    Ultimately the question I would ask is:

    What are the reasons for not releasing the source code of Freelancer, when he happened to so many other games such as Freespace 2?

    Linkus, your name looks familiar discovery gaming community (http://www.discoverygc.com)

    ... I must comment on your closing above statement...:

    "The end is the question I want to ask: .

    What are the reasons for not releasing the source code of Freelancer, when he happened to so many other games such as Freespace 2? »

    This is incorrect, as Freespace 2 has * nothing * to do with Microsoft, it was developed by Volition, Inc. and published by Interplay.

    These companies are not divisions of Microsoft.

    A better final statement would be asked about their release the Source codes of the franchisees Mech Commander, MechWarrior and Mech assault.

    The Battletech Franchise was a substantially larger intellectual property; and yet, they released their grip on it.

    (Although FASA / Weisman have reformed as Smith and Tinker, teaming with Piranha to do a full restart of the MechWarrior series, apparently the first deadline this year.)

    Who would actually have weight in an argument as to why they won't leave a much smaller intellectual property to the modding community.

  • Required privilege to view the source code for the stored procedure

    RDBMS Version: 11.2.0.4

    Platform: Oracle Linux 6.4

    In our Production database, we have an application schema named CRM_PROD. And we have a read-only user named steve in this PB.

    Steve must be able to view the source code of all stored procedures, functions and packages in the CRM_PROD schema. But steve shouldn't be able to run these procedures, functions and packages in the CRM_PROD schema. What a privilege should give Steve for this?

    SYS is owner of the dictionary of data and tables for the source code. See configuration of privilege and role authorization - 11 g Release 2 (11.2).

    Select it no matter what dictionary grant will give user (read) access to the full data dictionary.

  • How do I know if a loaded SWF file have the source code?

    Hi!, I need to know if a loaded SWF file have the source code. I develop an application running on iOS and admin can upload SWF files that show in the APP, but I must know before show (mobile Adobe AIR APP) or activate (PHP script server), if this SWF file have the source code for no show or enable him not it.,.

    Thank you!

    I have it!

    Only that we need to do is:

    1. If the first tank is:

    F-the swf is uncompressed

    C - compressed with Deflate

    Z - compressed with LZMA

    2. If it is compressed, uncompress it with the right method

    3. search MainTimeline string, if concluded the SWF actionscript so it is not found, the code is not actionscript.

  • < br > tag in live code, but not in the source code

    I'm having a problem with my form such that there is a huge gap between my section break and my table below.  The source code to this article looks like this:

    < div class = "right" > < / div >

    < class li = "section_break" >

    < /li > < /ul >

    < name of the form 'Form' = >

    < table width = "470" id = "Orders" border = "0" >

    < tr align = "left" valign = "top" >

    < td > < class = "description" label for = "element_6" > size < / label >

    However, my direct code at the same location shows something in a different way:

    < div class = "right" > < / div >

    < /li > < class li = "section_break" >

    < /li > < /ul >

    < br > < br > < br > < br > < br > < br > < table width = "470" id = "Orders" border = "0" >

    < tbody > < tr align = "left" valign = "top" >

    < td > < class = "description" label for = "element_6" > size < / label >

    I've no idea how out the < br > tags and they have to go.  Any help is greatly appreciated. Thank you!

    In your original code, you have a lot of
    Tags in the meantime andtags that belong here (see below). Go through the code of the table and get rid of them, 5 in total I think. Also, you cannot nest a

    in one. You start with an opening
    and only close together at the end of the page. What sort and it will get a little better.


           


     
       




       

  • using the source code?

    Sorry for the noob questions, but I am confused on how to use the Flex source code.

    Say I have download office saqoosha Fireworks.

    http://saqoosha.NET//?s=Fireworks

    I ussually just extract the folder in my workspace, go to flex, create a new actionscript project, and name the name of the folder in my workspace. Most of the time this does not work because I do not know how what actionscript file launches the app. Does anyone have an tips for me? And if possible somone could explain how I can use the source code of saqooshas and launch through flex.

    Thank you very much

    Michael

    Try to decompress the folder file somewhere else and using-> import-> Flex project to bring this project into your workspace, rather than copy directly. Then Flex stands at what file to run etc. for you. I pulled down the Fireworks bill you mentioned and it ran without problem.

  • Firefox 41.0.2 long lines don't wrap when you view the source code

    When I try to view the source code of a web page, I have to use horizontal scrolling. How can I make the text as it does on my IE6?

    If necessary, you can change the setting in this way as well:

    (1) in a new tab, type or paste Subject: config in the address bar and press enter/return. Click on the button promising to be careful.

    (2) in the search above the list box, type or paste wrap it up and make a pause so that the list is filtered

    (3) double-click the preference view_source.wrap_long_lines to switch the value from false to true

  • I want to take the source code of each Web page as input and address on it, how can I do this?

    I'll develop an add-on for mozilla firefox, but for this I need the source code for each page. This is necessary to find the tag button inside the source code, to search for the tag href in the source code, etc... So please help me for this.

    The forum of the add-on is here:
    https://forums.addons.Mozilla.org/

  • A medium terminal to download the source code of a page

    Hello
    I want to find a way to download the source code of a page and the problem is, when I try to download html, which is generated by js.
    So I want to check (and change + firefox automatically the source code generated by a script, but don't know how.)
    Thank you.

    Just used phantomjs

Maybe you are looking for