How to compile packge inside procedure which uses this package

ORACLE 10g, 11g
CREATE OR REPLACE PACKAGE PKG_TEST_COMMIT
PROCEDURE Insert_into_table_T1;
PROCEDURE Update_table_T1;
END PKG_TEST_COMMIT;
CREATE OR REPLACE PROCEDURE PROC_TEST_COMMIT As
Begin
PKG_TEST_COMMIT. Insert_into_table_T1; --insert data into table T1
EXECUTE IMMEDIATE 'DROP table T1';
EXECUTE IMMEDIATE
'create table T1 as select ''1'', ''d'', ''s' from DUAL'; -- now package PKG_TEST_COMMIT in uncompiled stage
-- compile package
DBMS_DDL.alter_compile('PACKAGE', 'OWNER', 'PKG_TEST_COMMIT');
PKG_TEST_COMMIT. Update_into_table_T1;
End PROC_TEST_COMMIT;
When I try to run PKG_TEST_COMMIT I’Ve got an error: can’t lock the package.
I tried to create separate procedure for compilation, but result is the same.
If I finish PROC_TEST_COMMIT before compiling, then compile – OK.
Is there is a way to compile package inside the procedure?

I need to automate the process which first call some procedure from the package, then invalidate this package by dropping and recreating the table (I didn't create the code, but I can see thepoint init - this is the farstest way to populate huge table) and then call another proc from the same package (using table just cretated).
Otherwise I need human attention to this process. If it is imposible I can substitude "drop table and create table" for truncate and insert", but I am afraid it will take too long.

Similar Messages

  • How to modify the Procedure which exists in Package individually?

    Hi,
    I need to modify the procedure which exists in package individually. I.e. I don't want to recompile the entire package.
    This task to be done in SQL Plus not in TOAD. Because in TOAD, we can directly place the script and recompile using the option.
    Do we have any syntax to modify the procedure which exists in package?
    [Like.....     create or replace schema.packagename.procudrename....etc...?]
    Kindly reply if you are not clear on my query.
    Kindly help me on this.

    Explain the reason why this would make any sense. Convenience. I wouldn't mind this option either.
    1) Currently, i am working on a PACKAGE which has
    over 2k lines. In general, changes are made in a
    single PROCEDURE only. I then copy the code (from
    notepad) and paste it into SQL*Plus. This takes a few
    seconds. If i could just ALTER the one PROCEDURE, it
    would save time. (The little adds up to a lot during
    testing.)
    2) If two developers want to modify the two parts of
    the same PACKAGE they would have to rename the
    PACKAGE so one's changes do not overwrite the other.
    Allowing to change the particular PROCEDURE inside
    the PACKAGE would obviate this need.
    3) If PACKAGES are to be stored in a versioning
    system, it might be convenient to store each
    PROCEDURE separately, instead of storing the entire
    PACKAGE as one file.
    It is certainly not required, but it would be a nice
    convenience. That is why it would make sense.OK, then why did you chose to make packages? You do realize you can make stand alone procedures / functions outside of packages don't you?
    I can see how 2 seconds of waiting for a package to compile could set your testing back by weeks (warning, being highly sarcastic).

  • Calling Stored procedure which uses Bulk Collect

    Hi All, I have Oracle stored procedure which uses Bulk Collect and returns table type parameter as output. Can anyone please help me how Can I call this kind of stored procedures which returns table type output using VB and Oracle's Driver. (I am successfully able to call using MS ODBC driver, but I want to use OraOLEDB driver.)

    861412 wrote:
    how Can I call this kind of stored procedures which returns table type output using VB and Oracle's Driver. This forum deals with the server-side languages SQL and PL/SQL.
    Your question deals with the client side and Visual Basic language.

  • How to compile a java file which is in memory?

    how to compile a java file which is in memory?
    such as:
    String s="class MyClass {....}";
    how to compile the string?
    thx

    come on ...That was a perfectly valid solution.
    Do you know how to call the sun.* compiler? If not then search the forums for it. If that interface still exists (which it might not in newer versions) you then will create a string stream from your class and pass it to that.

  • How to create a stored procedure and use it in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    If you are using MSSQL SERVER then try creating a stored procedure like this
    create proc Name
    select * from Table
    by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
    here is the syntax to create SP
    Syntax
    CREATE PROC [ EDURE ] procedure_name [ ; number ]
        [ { @parameter data_type }
            [ VARYING ] [ = default ] [ OUTPUT ]
        ] [ ,...n ]
    [ WITH
        { RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
    [ FOR REPLICATION ]
    AS sql_statement [ ...n ]
    Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
    Regards,
    Raghavendra
    Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM

  • ORA-06502 during a procedure which uses Bulk collect feature and nested tab

    Hello Friends,
    have created one procedure which uses Bulk collect and nested table to hold the bulk data. This procedure was using one cursor and a nested table with the same type as the cursor to hold data fetched from cursor. Bulk collection technique was used to collect data from cursor to nested table. But it is giving ORA-06502 error.
    I reduced code of procedure to following to trace the error point. But still error is comming. Please help us to find the cause and solve it.
    Script which is giving error:
    declare
    v_Errorflag BINARY_INTEGER;
    v_flag number := 1;
    CURSOR cur_terminal_info Is
    SELECT distinct
    'a' SettlementType
    FROM
    dual;
    TYPE typ_cur_terminal IS TABLE OF cur_terminal_info%ROWTYPE;
    Tab_Terminal_info typ_cur_Terminal;
    BEGIN
    v_Errorflag := 2;
    OPEN cur_terminal_info;
    LOOP
    v_Errorflag := 4;
    FETCH cur_terminal_info BULK COLLECT INTO tab_terminal_info LIMIT 300;
    EXIT WHEN cur_terminal_info%rowcount <= 0;
    v_Errorflag := 5;
    FOR Y IN Tab_Terminal_Info.FIRST..tab_terminal_info.LAST
    LOOP
    dbms_output.put_line(v_flag);
    v_flag := v_flag + 1;
    end loop;
    END LOOP;
    v_Errorflag := 13;
    COMMIT;
    END;
    I have updated script as following to change datatype as varchar2 for nested table, but still same error is
    comming..
    declare
    v_Errorflag BINARY_INTEGER;
    v_flag number := 1;
    CURSOR cur_terminal_info Is
    SELECT distinct
    'a' SettlementType
    FROM
    dual;
    TYPE typ_cur_terminal IS TABLE OF varchar2(50);
    Tab_Terminal_info typ_cur_Terminal;
    BEGIN
    v_Errorflag := 2;
    OPEN cur_terminal_info;
    LOOP
    v_Errorflag := 4;
    FETCH cur_terminal_info BULK COLLECT INTO tab_terminal_info LIMIT 300;
    EXIT WHEN cur_terminal_info%rowcount <= 0;
    v_Errorflag := 5;
    FOR Y IN Tab_Terminal_Info.FIRST..tab_terminal_info.LAST
    LOOP
    dbms_output.put_line(v_flag);
    v_flag := v_flag + 1;
    end loop;
    END LOOP;
    v_Errorflag := 13;
    COMMIT;
    I could not find the exact reason of error.
    Please help us to solve this error.
    Thanks and Regards..
    Dipali..

    Hello Friends,
    I got the solution.. :)
    I did one mistake in procedure where the loop should end.
    I used the statemetn: EXIT WHEN cur_terminal_info%rowcount <= 0;
    But it should be: EXIT WHEN Tab_Terminal_Info.COUNT <= 0;
    Now my script is working fine.. :)
    Thanks and Regards,
    Dipali..

  • How to prevent people asking how to prevent "click to activate and use this control"

    When I visit the fourms, I keep seeing these questions about
    how to disable
    "click to activate and use this control". Its really annoying
    and
    disrupting my web experience. I do know this really this is a
    blatant
    attack on Adobe and Flash by Microsoft and is obviously
    related to the Adobe
    takeover of Macromedia, and probably also related to the fact
    that it is now
    impossible for anyone to install Flash Player (which Adobe is
    ignoring
    because their support is so useless since the takeover). Is
    there something
    I can do to prevent these questions being posted? I've
    searched all the
    forums and cannot find any information. Surely someone else
    has had this
    problem.
    Jeckyl

    Some people don't like to search...
    Some people don't know what to search...
    Some people don't even know there is a search...
    Just ask them to search for "click to activate and use this
    control".
    Search
    Flash Support Forums
    Search
    Google

  • I recently bought an iphone 4s from people who are not in the know and restore my iphone .. Now do not be in use for not having ID and password ... Owner apple owner just gave me a serial number how do I want to continue to use this ... Their telephone he

    I recently bought an iphone 4s from people who are not in the know
    and restore my iphone .. Now do not be in use for not having ID and password ... Owner apple owner just gave me a serial number how do I want to continue to use this ... Their telephone help me: (

    I am having same problem . i can not use the phone. my Carrier ROGERS checked the phone its not stolen or lost phone but after restoring always ask for apple ID of previous owner and seller is not responding to any mails or phone if some one can help me out than it will be great.
    thank you

  • How can i get a file header using this method cl_gui_frontend_services= gui

    Hi Experts,
    How can i get a file header using this method cl_gui_frontend_services=>gui_download
    Thanks
    Basu

    Hi,
    You can use the FM - GUI_DOWNLOAD to specify the headers. It can be done in the following manner -
    TYPES: BEGIN OF ty_head, "Structure for header
                 h(10) TYPE c,
                 END OF ty_head.
    DATA: it_head  TYPE TABLE OF ty_head WITH HEADER LINE.
    "Adding header details
    it_head-h = 'Field1'.
    APPEND it_head.
    it_head-h = 'Field2'.
    APPEND it_head.
    it_head-h = 'Field3'.
    APPEND it_head.
    it_head-h = 'Field4'.
    APPEND it_head.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = p_file
       filetype                        = 'ASC'
       write_field_separator           = 'X'
       header                          = '00'  "<= note this
      TABLES
        data_tab                        = it_tab
       fieldnames                      = it_head[] "<= Pass your header table here
    EXCEPTIONS
       OTHERS                          = 1.
    Hope this helps.
    Regards,
    Himanshu

  • How to replace a function/procedure/trigger using datapump

    Hi All and thanks for any help you can provide!
    My goal is to export our production schema -- table data, function and procedure definitions, triggers and sequences -- and import all of that into the QA schema.
    Here is the expdp command from production
    expdp / as sysdba
    DIRECTORY=EXPORT_DATA
    SCHEMAS=CP_APP
    DUMPFILE=cp_app_01.dmp
    LOGFILE=cp_app_01.log
    I then move the file from the production server to the qa server and use this command to import it.
    impdp / as sysdba
    DIRECTORY=IMPORT_DATA
    CONTENT=ALL
    TRANSFORM=OID:N
    DUMPFILE=cp_app_01.dmp
    TABLE_EXISTS_ACTION=REPLACE
    REMAP_SCHEMA=CP_APP:CP_QA
    The problem is that triggers don't get built properly. Here's one error
    ORA-39083: Object type TRIGGER failed to create with error:
    ORA-00942: table or view does not exist
    Failing sql is:
    CREATE TRIGGER "CP_QA"."PLAYER_LOG_EMAIL_INS_TRIGGER"
    before insert on cp_app.player_log_email
    for each row
    begin
    -- auto-increment --
    select seq_player_log_email.nextval into :new.log_id from dual;
    end;
    The REMAP_SCHEMA option only changes the schema of the trigger itself, but it did not affect the schema of the referenced table.
    Any suggestions on how to get PL/SQL objects rebuilt?
    Thanks for any help.
    -- Chris Curzon

    Hi,
    this is a known issue and is also desribed in the manuals. There is a note on Oracle Support: "IMPDP Reports ORA-942 and ORA-39083 During Importing Schema Objects [ID 750783.1]". It describes a solution, in the simplest way:
    Make an sql dump of the import, add the last parameter:
    impdp / as sysdba
    DIRECTORY=IMPORT_DATA
    CONTENT=ALL
    TRANSFORM=OID:N
    DUMPFILE=cp_app_01.dmp
    TABLE_EXISTS_ACTION=REPLACE
    REMAP_SCHEMA=CP_APP:CP_QA
    sqlfile=script.sqlNow you have the file script.sql in which you find your trigger code. Adjust in this file the schema names and run the code against the database.
    Another option would be to adjust the trigger code in the source database to not reference the schema.
    Herald ten Dam
    http://htendam.wordpress.com

  • How to create a function/procedure which can take optional parameter?

    Hi,
    I want to create a function or a procedure which can take optional parameters. For example, I want to create fun1() or fun1(param1) like this. Only one function will act differently when different number of parameters are passed to it. Something like the substr() function in oracle. It can be called with 2 parameters, as well as three parameters.
    Thanks in advance,
    Kiran

    There are two ways of doing this. The regular way would be to add a DEFAULT clause to your function declaration:
      -- Function can be called with 1 or 2 parameters
      FUNCTION xxxx
        ( param_one  NUMBER
        , param_two  VARCHAR2  DEFAULT NULL )
      RETURN VARCHAR2;Or, if your functions are declared in a package you can do some over-loading:
      PACKAGE yyyy
      IS
        -- Function with 1 parameter
        FUNCTION xxxx
          ( param_one  NUMBER )
        RETURN VARCHAR2;
        -- Function with 2 parameters
        FUNCTION xxxx
          ( param_one  NUMBER
          , param_two  VARCHAR2 )
        RETURN VARCHAR2;
      END;If you are calling server-side functions from client-side tools (like OracleForms) you may need to use this second method.

  • How to call a stored procedure that use a type defined in a package?

    Hi all,
    this is stored procedure:
    GET_GIORNATAEVENTO( in_nome_servizio IN VARCHAR2,
    out_dati_aggiornati OUT TAB_VARCHAR2);
    TAB VARCHAR2 is defined in the package specification:
    TYPE tab_varchar2 IS TABLE OF VARCHAR2(5) INDEX BY BINARY_INTEGER;
    and this is the name of the package: PKG_SERVIZI_MMSPUSH.
    This is my php script:
    <?php
    // Connect to database...
    $c=OCILogon("venus_vfl", "venus_vfl", "venvi");
    if ( ! $c ) {
    echo "Connessione non riuscita: " . var_dump( OCIError() );
    die();
    echo "<br>PKG_SERVIZI_MMSPUSH.GET_GIORNATAEVENTO</br> ";
    echo "<br> </br>";
    // Call database procedure...
    $in_servizio = "MOTO";
    $s = OCIParse($c, "begin PKG_SERVIZI_MMSPUSH.GET_GIORNATAEVENTO(:bind1, :bind2); end;");
    OCIBindByName($s, ":bind1", $in_servizio);
    OCIBindByName($s, ":bind2", $out_esito);
    OCIExecute($s,OCI_DEFAULT);
    echo "OUT_DATI_AGGIORNATI= " . $out_esito;
    // Logoff from Oracle
    OCILogoff($c);
    ?>
    How to test stored procedure to get the output parameter?
    Thanks in advance.

    Thanks,
    but I need to test stored procedures that uses type defined in the package.
    e.g.
    if I have s.p.
    PROCEDURE get_risultati_squadra
    ( in_squadra IN VARCHAR2,
    out_serie OUT tab_varchar2_5,
    out_tiporisultato OUT tab_varchar2_5,
    out_n_giornata OUT tab_varchar2_5,
    out_squadre OUT tab_varchar2_200,
    out_risultato OUT tab_varchar2_10,
    out_marcatore OUT tab_varchar2_50,
    out_punti OUT tab_varchar2_3,
    out_rimbalzista OUT tab_varchar2_50,
    out_rimbalzi OUT tab_varchar2_3,
    out_esito OUT tab_varchar2_2);
    I have to define every type external to the package, in this case five new TYPE !!
    Is there another way to solve this problem?
    Thanks

  • How to call a write procedures which has output parameters in an xsodata service?

    Hi,
    I have a use case where we call a Stored procedure from an xsodata service, where in I also need some output from procedure.
    We couldn’t achieve this because whenever I pass some output from my procedure , framework is considering the response as an error always.
    Looks like we cannot pass back any values apart from errors.
    Since we are doing some insert statements in our procedure I couldn't even wrap the procedure using calculation view
    because from calculation view we can call only call only read only procedure.
    What is the right way of calling a write procedure which returns some output always apart from error from an xsodata service?
    Thanks and Regards,
    Arjun

    Another suggestion Arjun,
    you said you have a writeable procedure with you, which will return a result set after the processing. You split the procedure into two, one writeable and one read only, so that the writeable will update the data, and read only procedure would return the required result set. The, use xsjs to call the writeable, and use xsodata to call the read only procedure(complicate it man ). 
    Sreehari

  • How to call a stored procedure which has out parameter value

    my code is
    public Connection createConnection() {
                   Connection conn = null;
                        try {
                             Class.forName(DRIVER);
                             conn = DriverManager.getConnection(URL,USER,PASS);
                        } catch (ClassNotFoundException cnfe) {
                             System.err.print("Class not found");
                        } catch (SQLException sqle) {
                             System.err.print("SQLException");
                   return conn;
         public static void main(String args[]){
              StroedProcedure stp = new StroedProcedure();
              Connection con = stp.createConnection();
              try {
                   CallableStatement stproc_stmt = con.prepareCall("{call Account_Summary(?,?,?,?,?,?,?,?)}");
                   stproc_stmt.setString(1, "123456");
                   stproc_stmt.setDate(2, null);
                   stproc_stmt.setString(3, null);
                   stproc_stmt.setString(4, null);
                   stproc_stmt.setString(5, null);
                   stproc_stmt.setString(6, null);
                   stproc_stmt.setDate(7, null);
                   stproc_stmt.setDate(8, null);
                   stproc_stmt.registerOutParameter(1,Types.CHAR);
                   stproc_stmt.registerOutParameter(2,Types.DATE);
                   stproc_stmt.registerOutParameter(3,Types.CHAR);
                   stproc_stmt.registerOutParameter(4,Types.CHAR);
                   stproc_stmt.registerOutParameter(5,Types.CHAR);
                   stproc_stmt.registerOutParameter(6,Types.CHAR);
                   stproc_stmt.registerOutParameter(7,Types.DATE);
                   stproc_stmt.registerOutParameter(8,Types.DATE);
                   stproc_stmt.execute();
                   System.out.println("test "+stproc_stmt.getString(1));
                   ResultSet rs = stproc_stmt.executeQuery();
                  while (rs.next()){
                       System.out.println("result "+rs.getString("ACCPK"));
              } catch (SQLException e) {
                        e.printStackTrace();
         }And the stored procedure is
    CREATE OR REPLACE
    procedure Account_Summary (accpk in out char, incdt out date, bcur out char, bmark out char, tarTE out char, numHold out char, stDt out date, AsDt out date)
    is
    begin
    select account_pk, inception_date, base_currency, benchmark  into accpk, incdt, bcur, bmark
    from account a
    where a.Account_pk=accpk;
    select target_te, number_holdings, start_date, as_date into tarTE, numHold, StDt, AsDt
    from acc_summary asum
    where asum.account_pk=accpk;
    end Account_Summary;but it gives a exception ORA-01460: unimplemented or unreasonable conversion requested
    ORA-06512: at "REPRO.ACCOUNT_SUMMARY", line 4
    ORA-06512: at line 1
    i want to execute a stored procedure which has in , inout or out parameter
    but it can not work

    ========================
    In some contects varchar2 variable limit is 32512 characters... October 16, 2003
    Reviewer: Piotr Jarmuz from Poznan, Poland
    Interesting to note is the fact that varchar2 variables as parameters to stored
    procedures (in in/out out) may be "only" 32512 bytes long.
    I've checked this in Java and Perl. 32512 is the last value that works, for any
    bigger it throws:
    Exception in thread "main" java.sql.SQLException: ORA-01460: unimplemented or
    unreasonable conversion requested
    But in PL/SQL as you said 32767
    Regards,
    Piotr
    =================================
    This i got it from ask tom, well it make sense.... try checking your input with small numbers and strings
    Have fun

  • How to delete data from a file using IO package

    Hi All,
    i am trying to remove some content of the file.
    this content is not at starting of file not even at end of file.
    can anybody tell me how can i delete number of lines from file using IO package.

    iam having some data in text file .ex:in flowrist.txt
    12/5/07,500,300,6000 like many set of datas are
    there.In these if i want to delete the data based on
    the date which i specified.How to do this specific
    deletion?You need to open a stream to read in the file and then use the indexOf method provided in the Sting class to check if the line contains the date or whatever String you are looking for, if so then skip that line and store or re-write the lines you wish to keep, as well as some extra lines you may wish to add.
    Take a look below at this example found on Google.
    http://www.java-tips.org/java-se-tips/java.io/how-to-read-file-in-java.html
    The above read a file line by line and prints it to console. You should be able to modify this, instead of using System.out to print the line you should use index of to check the lines for a date/String. Index of return -1 if the String you specify is not in the line you parse.

Maybe you are looking for

  • How can I create a rotating basketball image in Motion?

    I need to have a basketball rotate and do a full 360 degree. I took an image from Google Images and dragged into Motion and applied the sphere filter. Is that the best 3D looking basketball I can get from a 2D image? Thanks! Message was edited by: Ho

  • Password apple id, no longer accepted in mail iphone ipad devices

    my Mail app in iphone and ipad doesn't accept password anymore. it was working for years. i read instruction and forums , i've changed password Apple twice, both changes have been accepted, but the problem seems to be my in the ios devices. As soon a

  • PS CC Video Layer Smart Object error

    I think I have found a bug, I'd like to see if it's reproducible for others.  I don't know what the actual error is, but the error message says 'Photoshop could not complete the request because of a program error' (which I'm guessing is just a genera

  • IFS & Cocoon / XSP

    Hi, I'm currently fighting with iFS and XSP ... The goal is to have an XSP-Taglib for iFS to use iFS functionality in XSP-Server-Pages ... An example XSP-Taglib works without any Problems, as well as an stand-alone Java program to put a document into

  • Double Invoice Check

    Hi How do we set the double invoice check in SPRO for Invoice Number and Reference field for Vendor Incoming Invoices Regards Sanil Bhandari