Executing a procedure in package

Hi,
How to execute a procedure in a package? Below is the package
CREATE OR REPLACE PACKAGE BODY POPULATE_GLTD_TABLES
IS
-- LOCAL VARIABLES
val1 VARCHAR2(10);
-- Create some job objects:
v_job1_str VARCHAR2(4000) ;
v_job1 XXMCK.XXMCK_JOB_OT;
PROCEDURE populate_gltd_tabs1
IS
BEGIN
dbms_output.put_line('Get_status=> v_job1: ');
val1:= F_CHECK_GLTD_RECORD_EXISTS('MCK_GLTD_1');
IF val1 != 'S' THEN
-- Include message details value - TRUE if yes and FALSE if no
xxmck.mck_write_log_msg.set_msg_tail(TRUE);
xxmck.mck_write_log_msg.purge('GLTD-TASK1');
-- set context will define the source as well as inserts data into cont exit table
xxmck.mck_write_log_msg.set_context(v_parent_program,v_prog_desc,'GLTD-TASK1');
xxmck.mck_write_log_msg.log(v_parent_program,'Entering in LOAD_GLTD_TABLES.populate_gltd_tabs1 ','prg','GLTD-TASK1',1);
xxmck.mck_write_log_msg.log_tail(v_parent_program,'Entering in LOAD_GLTD_TABLES.populate_gltd_tabs1 ','prg','GLTD-TASK1');
v_job1_str := 'XXCOGNOS.LOAD_GLTD_TABLES.populate_gltd_tabs1;';
v_job1 := NEW XXMCK.XXMCK_JOB_OT('GLTD-TASK1', v_job1_str, 'Background job test: LOAD_GLTD_TABLES.populate_gltd_tabs1', INTERVAL '60' SECOND);
v_job1.PRINT(); -- Display basic info about the job
v_job1.SUBMIT(); -- Submit in background
v_job1.WAIT();
v_job1.PRINT();
v_job1.get_status(v_code, v_message);
dbms_output.put_line('Get_status=> v_job1: ' || v_code || ':' || v_message);
-- SELECT DECODE(cont_exit, 'cont', 'cont', 'err', 'err', 'cont') INTO v_result from MCK_LOG_CONT_EXIT_CHK WHERE source = 'GLTD-TASK1';
--IF v_result = 'err' THEN
-- raise_application_error(-20000,'Program Aborted');
--END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN NULL;
END populate_gltd_tabs1;
PROCEDURE mainproc
IS
BEGIN
populate_gltd_tabs1; -- CALL TO POPULATE mck_gltd_1 TABLE
-- Mailing
xxmck.mck_write_log_msg.send_mail( p_source_prg => v_parent_program
,p_source => 'GLTD-TASK1'
,p_msg_type => 'prg'
,p_from => '[email protected]'
,p_to => '[email protected]'
,p_server => 'mailhub.mckinsey.com'
EXCEPTION
WHEN OTHERS THEN NULL;
END mainproc;
END POPULATE_GLTD_TABLES;
And below is my anonymous block to execute above package
BEGIN
POPULATE_MCK_GLTDFILE.mainproc;
EXCEPTION -- exception handler begin
WHEN OTHERS THEN NULL;
END;
I am trying to run above code in toad. But i am getting error as: identifier 'POPULATE_MCK_GLTDFILE.mainproc' must be declared.
There are no parameters to be passed.
The package is compiled successfully.
I think this must be simplest question any one can I ask, but I cant figure out the solution.
Please help,
Aditya

First remove the horrible exception handler(s) which are hiding all errors;
ie the
when others
then
null;
end;Then remember the main syntax is
begin
packagename.procedurename;
end;
/But also remember that procedure name must be declared in the package header if you want to call it. (This is called a public procedure). A private procedure does not have to be declared in the package header and can only be called from within the same package body.
I always use sqlplus for verification as that is delivered with oracle. You know if it works with sqlplus it will work with any othere client and if it does not, it's usually a client issue.
from what you have posted, There is nothing obvious as to why it won't work.

Similar Messages

  • Error while executing a procedure in Package

    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package "PLLODS.LK" has been invalidated
    ORA-04065: not executed, altered or dropped package "PLLODS.LK"
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at line 1Why did this error arise when I changed a package and recompiled?

    This errors occurs when a package was executed in session A, compiled in session B, and then executed again in session A. The package executed in session A is in Oracle buffer, but its definition was changed in session B (which session A is unaware of). Now session A uses the old definition of the package but Oracle checks what is in buffer to the new definition and finds a difference. Therefore, it generates an error:
    ORA-04068: existing state of packages has been discarded
    and other related errors.
    Just execute the procedure (in the package) again and you should not see the error again.
    Make sure the stae of the package is valid, that is, when it was recompiled, the package compiled successfully.
    Shakti
    http://www.impact-sol.com
    Developers of Guggi Oracle - Tool for Developers and DBAs

  • Executing A Procedure In a Package Using DBLink

    I need to execute a procedure which is residing in a package using dblink.
    The package got a execute PUBLIC grant.
    When I execute the following statement, I am getting error ORA: 00904, Invalid Identifier
    select PKG_NAME.PROCEDURE_NAME@dblink(null,null,null,null,null,null,null,null,null,null,null) from dual
    How can I execute the above statement.
    Thanks in advance

    I have a database INLABNEW in that i have done this
    SQL> create table temp(no number)
      2  /
    Table created.
    SQL> create or replace package pkg
      2  as
      3     procedure p;
      4  end;
      5  /
    Package created.
    SQL>  create or replace package body pkg
      2   as
      3      procedure p
      4      is
      5      begin
      6             insert into temp values(1);
      7      end;
      8   end;
      9  /
    Package body created.
    SQL> select * from temp
      2  /
    no rows selectedNow i executed the procedure pkg.p from another database
    SQL> exec pkg.p@to_inlabnew
    PL/SQL procedure successfully completed.
    SQL> commit
      2  /And i query the table tmp in INLABNEW
    SQL> select * from temp
      2  /
            NO
             1Now question is have you given your procedure name properly.
    as your procedure is in a package it should be Your_package_name.Your_procedure_name@Your_db_link

  • SSIS package fails when it is executed by procedure (2008)

    Hi there,
    I have a very anoying problem with SSIS. I've done new packages into same project, almost identical compared to old ones. They work well in visual studio, but I can't execute them using procedure. Old packages works just fine, but none of the new. Error
    message is in the end of my story.
    Visual Studio version is 9.0.30729.1 and SQL Server version is 10.0.4000.0. Is it possible, that these not not updated versions could cause this problem?
    Package ProtectionLevel is DonSaveSensitive.
    Br,
    Ville
    Error messages, when package is executed by procedure:
    Microsoft (R) SQL Server Execute Package Utility
    Version 10.50.1600.1 for 64-bit
    Copyright (C) Microsoft Corporation 2010. All rights reserved.
    NULL
    Started:  10:36:48 AM
    Error: 2015-03-31 10:36:48.48
       Code: 0xC0016016
       Source:  
       Description: Failed to decrypt protected XML node
    "DTS:Password" with error 0x8009000B "Key not valid for use in
    specified state.". You may not be authorized to access this information.
    This error occurs when there is a cryptographic error. Verify that
     the correct key is available.
    End Error
    Progress: 2015-03-31 10:36:48.65
       Source: Data Flow Task 1
       Validating: 0% complete
    End Progress
    Progress: 2015-03-31 10:36:48.81
       Source: Data Flow Task 1
       Validating: 50% complete
    End Progress
    Progress: 2015-03-31 10:36:48.81
       Source: Data Flow Task 1
       Validating: 100% complete
    End Progress
    Progress: 2015-03-31 10:36:48.82
       Source: Data Flow Task 1
       Validating: 0% complete
    End Progress
    Progress: 2015-03-31 10:36:48.88
       Source: Data Flow Task 1
       Validating: 50% complete
    End Progress
    Progress: 2015-03-31 10:36:48.89
       Source: Data Flow Task 1
       Validating: 100% complete
    End Progress
    Progress: 2015-03-31 10:36:48.89
       Source: Data Flow Task 1
       Prepare for Execute: 0% complete
    End Progress
    Progress: 2015-03-31 10:36:48.89
       Source: Data Flow Task 1
       Prepare for Execute: 50% complete
    End Progress
    Progress: 2015-03-31 10:36:48.89
       Source: Data Flow Task 1
       Prepare for Execute: 100% complete
    End Progress
    Progress: 2015-03-31 10:36:48.95
       Source: Data Flow Task 1
       Pre-Execute: 0% complete
    End Progress
    Progress: 2015-03-31 10:36:49.03
       Source: Data Flow Task 1
       Pre-Execute: 50% complete
    End Progress
    Warning: 2015-03-31 10:36:49.03
       Code: 0x80070003
       Source: Data Flow Task 1 Destination - tb_month_standard_idx_table_exp_032013-082013_20140307_csv
    [34]
       Description: The system cannot find the path specified.
    End Warning
    Progress: 2015-03-31 10:36:49.28
       Source: Error Msg
       Executing query "insert into
    focusbase.dbo.tb_ctrl_package_error_ms...".: 100% complete
    End Progress
    Error: 2015-03-31 10:36:49.28
       Code: 0xC020200E
       Source: Data Flow Task 1 Destination -
    tb_month_standard_idx_table_exp_032013-082013_20140307_csv [34]
       Description: Cannot open the datafile
    "D:\Procogs_export_validation\StandardSetup\tb_month_standard_idx_table_exp_032013-082013_20140307.csv".
    End Error
    Progress: 2015-03-31 10:36:49.29
       Source: Error Msg
       Executing query "insert into
    focusbase.dbo.tb_ctrl_package_error_ms...".: 100% complete
    End Progress
    Error: 2015-03-31 10:36:49.29
       Code: 0xC004701A
       Source: Data Flow Task 1 SSIS.Pipeline
       Description: component "Destination -
    tb_month_standard_idx_table_exp_032013-082013_20140307_csv" (34) failed
    the pre-execute phase and returned error code 0xC020200E.
    End Error
    Progress: 2015-03-31 10:36:49.29
       Source: Data Flow Task 1
       Pre-Execute: 100% complete
    End Progress
    Progress: 2015-03-31 10:36:49.29
       Source: Data Flow Task 1
       Post Execute: 0% complete
    End Progress
    Progress: 2015-03-31 10:36:49.29
       Source: Data Flow Task 1
       Post Execute: 50% complete
    End Progress
    Progress: 2015-03-31 10:36:49.29
       Source: Data Flow Task 1
       Cleanup: 0% complete
    End Progress
    Progress: 2015-03-31 10:36:49.29
       Source: Data Flow Task 1
       Cleanup: 50% complete
    End Progress
    Progress: 2015-03-31 10:36:49.29
       Source: Data Flow Task 1
       Cleanup: 100% complete
    End Progress
    DTExec: The package execution returned DTSER_FAILURE (1).
    Started:  10:36:48 AM
    Finished: 10:36:49 AM
    Elapsed:  0.905 seconds
    NULL<o:p></o:p>
    <o:p> </o:p>
    <o:p> </o:p>

    Hi,
    That path is not in use?! Yes, it is in error, but not in package. Maybe it has been there before, but now I can't find it. Or actually, path is valid, but not the file name.
    I had on error in package configuration file path, but here is the latest error message:
    Br,
    Ville
    Microsoft (R) SQL Server Execute Package Utility
    Version 10.50.1600.1 for 64-bit
    Copyright (C) Microsoft Corporation 2010. All rights reserved.
    NULL
    Started:  1:50:59 PM
    Error: 2015-03-31 13:50:59.38
       Code: 0xC0016016
       Source:  
       Description: Failed to decrypt protected XML node
    "DTS:Password" with error 0x8009000B "Key not valid for use in
    specified state.". You may not be authorized to access this information.
    This error occurs when there is a cryptographic error. Verify that
     the correct key is available.
    End Error
    Progress: 2015-03-31 13:50:59.56
       Source: Data Flow Task 1
       Validating: 0% complete
    End Progress
    Progress: 2015-03-31 13:50:59.72
       Source: Data Flow Task 1
       Validating: 50% complete
    End Progress
    Progress: 2015-03-31 13:50:59.72
       Source: Data Flow Task 1
       Validating: 100% complete
    End Progress
    Progress: 2015-03-31 13:50:59.73
       Source: Data Flow Task 1
       Validating: 0% complete
    End Progress
    Progress: 2015-03-31 13:50:59.79
       Source: Data Flow Task 1
       Validating: 50% complete
    End Progress
    Progress: 2015-03-31 13:50:59.79
       Source: Data Flow Task 1
       Validating: 100% complete
    End Progress
    Progress: 2015-03-31 13:50:59.79
       Source: Data Flow Task 1
       Prepare for Execute: 0% complete
    End Progress
    Progress: 2015-03-31 13:50:59.79
       Source: Data Flow Task 1
       Prepare for Execute: 50% complete
    End Progress
    Progress: 2015-03-31 13:50:59.79
       Source: Data Flow Task 1
       Prepare for Execute: 100% complete
    End Progress
    Progress: 2015-03-31 13:50:59.86
       Source: Data Flow Task 1
       Pre-Execute: 0% complete
    End Progress
    Progress: 2015-03-31 13:50:59.92
       Source: Data Flow Task 1
       Pre-Execute: 50% complete
    End Progress
    Warning: 2015-03-31 13:50:59.92
       Code: 0x80070003
       Source: Data Flow Task 1 Destination -
    tb_month_standard_idx_table_exp_032013-082013_20140307_csv [34]
       Description: The system cannot find the path specified.
    End Warning
    Progress: 2015-03-31 13:51:00.17
       Source: Error Msg
       Executing query "insert into
    focusbase.dbo.tb_ctrl_package_error_ms...".: 100% complete
    End Progress
    Error: 2015-03-31 13:51:00.17
       Code: 0xC020200E
       Source: Data Flow Task 1 Destination -
    tb_month_standard_idx_table_exp_032013-082013_20140307_csv [34]
       Description: Cannot open the datafile
    "D:\Procogs_export_validation\StandardSetup\tb_month_standard_idx_table_exp_032013-082013_20140307.csv".
    End Error
    Progress: 2015-03-31 13:51:00.17
       Source: Error Msg
       Executing query "insert into
    focusbase.dbo.tb_ctrl_package_error_ms...".: 100% complete
    End Progress
    Error: 2015-03-31 13:51:00.17
       Code: 0xC004701A
       Source: Data Flow Task 1 SSIS.Pipeline
       Description: component "Destination -
    tb_month_standard_idx_table_exp_032013-082013_20140307_csv" (34) failed
    the pre-execute phase and returned error code 0xC020200E.
    End Error
    Progress: 2015-03-31 13:51:00.17
       Source: Data Flow Task 1
       Pre-Execute: 100% complete
    End Progress
    Progress: 2015-03-31 13:51:00.17
       Source: Data Flow Task 1
       Post Execute: 0% complete
    End Progress
    Progress: 2015-03-31 13:51:00.17
       Source: Data Flow Task 1
       Post Execute: 50% complete
    End Progress
    Progress: 2015-03-31 13:51:00.17
       Source: Data Flow Task 1
       Cleanup: 0% complete
    End Progress
    Progress: 2015-03-31 13:51:00.17
       Source: Data Flow Task 1
       Cleanup: 50% complete
    End Progress
    Progress: 2015-03-31 13:51:00.17
       Source: Data Flow Task 1
       Cleanup: 100% complete
    End Progress
    DTExec: The package execution returned DTSER_FAILURE (1).
    Started:  1:50:59 PM
    Finished: 1:51:00 PM
    Elapsed:  0.858 seconds
    NULL<o:p></o:p>

  • Error executing procedure in package

    If someone can help me, i'd greatly appreciate it!
    I created a package (see code below) in the Portal Navigator and I'm getting the following error when i try to execute the procedure:
    ORA-06550: line 2, column 16:
    PLS-00201: identifier 'CURSOR' must be declared
    ORA-06550: line 2, column 12:
    PL/SQL: Item ignored
    ORA-06550: line 4, column 46:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 6, column 20:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 6, column 1:
    PL/SQL: Statement ignored (WWV-11230)
    Failed to parse as PORTAL - declare
    local_var1 REF CURSOR;
    begin
    "CONCORD"."TAB_LINKS"."GETLINKS" ( VLINKS => local_var1, V_tab=> 'Analytics');
    htp.p(htf.br||'OUT parameter values:'||htf.br);
    htp.p('VLINKS - '||local_var1||htf.br);
    end; (WWV-08300)
    Create or Replace Package TAB_LINKS
    as
    TYPE vrefcur IS REF CURSOR;
    procedure getlinks(vlinks OUT tab_links.vrefcur,
              v_tab IN VARCHAR2 DEFAULT NULL);
    END;
    Create or Replace Package BODY TAB_LINKS
    AS
    procedure getlinks
    (vlinks OUT tab_links.vrefcur,
    v_tab IN VARCHAR2 DEFAULT NULL)
    as
    vsql varchar2(3000);
    vuser varchar2(50) := orasso.wwctx_api.get_user();
    vgroup number := orasso.wwsec_api.get_defaultgroup();
    BEGIN
    /* retrieves the links based on the title and group name */
    vsql := 'select url,target,name
    from table_links
    where groupid= '''||vgroup||'''
    and upper(cornertitle)
    = '''||upper(v_cornertitle)||'''
    and type = ''sidebar''
    order by itemid';
    --htp.p(vsql);
    open vlinks for vsql;
    END getlinks;
    END;

    I tried executing the code in orasso schema
    got below error first
    Error in creating PACKAGE BODY. (WWV-17098)
    Line No. 15 : PLS-00201: identifier 'V_CORNERTITLE' must be declared (WWV-17050)
    Line No. 11 : PL/SQL: Statement ignored (WWV-17050)
    ORA-24344: success with compilation error (WWV-11230)
    Failed to parse as PORTAL - create or replace package body ORASSO.TAB_LINKS as
    procedure getlinks
    (vlinks OUT tab_links.vrefcur,
    v_tab IN VARCHAR2 DEFAULT NULL)
    as
    vsql varchar2(3000);
    vuser varchar2(50) := orasso.wwctx_api.get_user();
    vgroup number := orasso.wwsec_api.get_defaultgroup();
    Declared 'v_cornertitle' ,the package got created.
    Complied also, the status shows valid.

  • How to execute private procedures in a package

    Hi
    I have created private procedures in a package.
    now i want to execute the private procedure. how to execute the private one

    Hi;
    Pelase see below which could be helpful for your issue:
    Private procedures in a package
    http://stackoverflow.com/questions/924490/how-do-i-execute-private-procedures-in-an-oracle-package
    Regard
    Helios

  • Executing procedures in packages.

    <p>Hi </p><p>I am using CR XI developer edition.</p><p>I want to call stored procedures that currently resides in a package.  In database explorer it shows me:</p><p>"mypackage.testProcedure"  when I select it to execute, it gives me an error telling me <user>.testProcedure must be declared.  It drops the "mypackage" reference. Is there a value in <databaseStructure> I can set to make it recoginize and run my procedures in packages??</p><p>  <GenericJDBCDriver><br />  <Option>No</Option><br /> <strong> <DatabaseStructure>catalogs,schemas,tables</DatabaseStructure><br /></strong>  <StoredProcType>Oracle</StoredProcType><br />  <LogonStyle>Oracle</LogonStyle><br /> </GenericJDBCDriver></p><p>what values can <databaseStructure> have??</p><p> Shirley</p>

    PLEASE POST YOUR QUESTIONS TO THE DEV FORUMS.
    Requirements of Oracle Stored Procedures
    In order for Crystal Reports to report off Oracle stored procedures, all of the
    following requirements must exist.
    u2022 To use an ODBC connection to access an Oracle stored procedure, you
    must create a package that defines the REF CURSOR. This REF CURSOR
    must be strongly bound to a static pre-defined structure (see Strongly Bound
    REF CURSORs vs Weakly Bound REF CURSORs). This package must be
    created separately and before the creation of the stored procedure.
    u2022 A native connection to Oracle in Crystal Reports 9 and Crystal Reports 10
    can be used to access an Oracle stored procedure that was created within a
    package and also an Oracle stored procedure that references a weakly bound
    REF CURSOR
    u2022 The stored procedure must have a parameter that is a REF CURSOR type.
    Crystal Reports uses this parameter to access and define the result set that
    the stored procedure returns.
    u2022 The REF CURSOR parameter must be defined as IN OUT (read/write
    mode). After the stored procedure has opened and assigned a query to the
    REF CURSOR, Crystal Reports will perform a FETCH call for every row
    from the queryu2019s result. This is why the parameter must be defined as IN
    OUT.
    u2022 The parameters can only be defined as IN (input) parameters. Crystal
    Reports is not designed to work with OUT parameters.
    u2022 The REF CURSOR variable must be opened and assigned its query within
    the procedure.
    Crystal Reports Oracle Stored Procedures
    2/18/2004 2:55 PM Copyright © 2004 Business Objects. All rights reserved. Page 4
    cr_oracle_stored_procedures.pdf
    u2022 The stored procedure can only return one record set. The structure of this
    record set must not changed, based on parameters.
    u2022 The stored procedure cannot call another stored procedure.
    u2022 If using an ODBC driver, it must be the CR Oracle ODBC driver installed
    by Crystal Reports.
    u2022 If you are using the CR ODBC driver, verify that the option u2018Procedure
    Return Resultsu2019 is selected as u2018Onu2019 in the ODBC Driver Configuration setup
    under the u2018Advancedu2019 tab.
    u2022 If you are using the native Oracle driver and using hard-coded date selection
    within the stored procedure, the date selection must use either a string
    representation format of YYYY-DD-MM (where the date field = 2004-01-
    01) or the To_Date formula function with the same format specified (where
    date field = To_Date(2004-01-01u2019,u2019YYYY-MM-DDu2019).
    u2022 Most importantly, the stored procedure must be able to execute successfully
    in Oracleu2019s SQL *Plus utility.
    If all of these requirements have been met, verify that the database driver that
    you are using works with that version of Oracle.
    Strongly Bound REF CURSORs versus Weakly
    Bound REF CURSORs
    When declaring the REF CURSOR in an Oracle package, the REF CURSOR
    may be strongly bound or it may be weakly bound.
    A strongly bound REF CURSOR is bound with the same structure that is used
    by the outputted SELECT statement in the Oracle stored procedure.
    CREATE OR REPLACE PACKAGE Test_Package
    AS TYPE Test_Type IS REF CURSOR RETURN Test_Table%ROWTYPE;
    END Test_Package;
    The example code in green displays the REF CURSOR strongly bound. In this
    example, the REF CURSOR is bound with the row structure of the Test_Table
    table.
    A weakly bound REF CURSOR is not assigned a structure in the Oracle
    package.
    CREATE OR REPLACE PACKAGE Test_Package
    AS TYPE Test_Type IS REF CURSOR;
    END Test_Package;
    Although the REF CURSOR is not assigned a structure in the Oracle package,
    the Oracle stored procedure itself must return a record set with a structure that
    does not change based on parameters.
    Crystal Reports Oracle Stored Procedures
    2/18/2004 2:55 PM Copyright © 2004 Business Objects. All rights reserved. Page 5
    cr_oracle_stored_procedures.pdf
    Creating an Oracle Stored Procedure
    Samples of stored procedures and their steps on how to create them are
    provided. These are samples of Oracle stored procedures that will return a result
    set in Crystal Reports. If these samples were executed in the Oracle connection
    utility, SQL *Plus, they should run successfully.
    NOTE These sample stored procedures are provided as a tip. Refer to your Oracle
    documentation for more information on creating stored procedures.
    Sample A: Use with ODBC and native
    connections in Crystal Reports
    1. Create a table.
    CREATE TABLE Test_Table
    (ID number(5),
    Firstname varchar2(30),
    Lastname varchar2(30),
    Birthday date);
    2. Insert values into the table.
    INSERT INTO Test_Table VALUES
    (1, 'Christopher', 'Jones', '01-Nov-70');
    INSERT INTO Test_Table VALUES
    (2, 'Maria', 'Marshall', '02-Jan-77');
    INSERT INTO Test_Table VALUES
    (3, 'Jonathan', 'Campbell', '09-Aug-75');
    INSERT INTO Test_Table VALUES
    (4, 'Julie', 'Gagnon', '23-Dec-72');
    INSERT INTO Test_Table VALUES
    (5, 'Daemon', 'Thompson', '11-Feb-69');
    3. Create the Package.
    CREATE OR REPLACE PACKAGE Test_Package
    AS TYPE Test_Type IS REF CURSOR RETURN Test_Table%ROWTYPE;
    END Test_Package;
    4. Create the stored procedure.
    CREATE OR REPLACE PROCEDURE Test_Procedure (
    Test_Cursor IN OUT Test_Package.Test_Type,
    Test_Parameter IN Test_Table.ID%TYPE)
    AS
    BEGIN
    Crystal Reports Oracle Stored Procedures
    2/18/2004 2:55 PM Copyright © 2004 Business Objects. All rights reserved. Page 6
    cr_oracle_stored_procedures.pdf
    OPEN Test_Cursor FOR
    SELECT *
    FROM Test_Table
    WHERE Test_Table.ID = Test_Parameter;
    END Test_Procedure;
    5. Once the stored procedure is successfully created on your Oracle database,
    execute the stored procedure.
    Sample B: Weakly Bound REF CURSOR
    Only use this sample with a native connection to Crystal Reports 9 or later.
    1. Create a table.
    CREATE TABLE Test_Table
    (ID number(5),
    Firstname varchar2(30),
    Lastname varchar2(30),
    Birthday date);
    2. Insert values into the table.
    INSERT INTO Test_Table VALUES
    (1, 'Christopher', 'Jones', '01-Nov-70');
    INSERT INTO Test_Table VALUES
    (2, 'Maria', 'Marshall', '02-Jan-77');
    INSERT INTO Test_Table VALUES
    (3, 'Jonathan', 'Campbell', '09-Aug-75');
    INSERT INTO Test_Table VALUES
    (4, 'Julie', 'Gagnon', '23-Dec-72');
    INSERT INTO Test_Table VALUES
    (5, 'Daemon', 'Thompson', '11-Feb-69');
    3. Create the Package.
    CREATE OR REPLACE PACKAGE Test_Package
    AS TYPE Test_Type IS REF CURSOR;
    END Test_Package;
    4. Create the stored procedure.
    CREATE OR REPLACE PROCEDURE Test_Procedure (
    Test_Cursor IN OUT Test_Package.Test_Type,
    Test_Parameter IN Test_Table.ID%TYPE)
    AS
    BEGIN
    Crystal Reports Oracle Stored Procedures
    2/18/2004 2:55 PM Copyright © 2004 Business Objects. All rights reserved. Page 7
    cr_oracle_stored_procedures.pdf
    OPEN Test_Cursor FOR
    SELECT *
    FROM Test_Table
    WHERE Test_Table.ID = Test_Parameter;
    END Test_Procedure;
    5. Once the stored procedure is successfully created on your Oracle database,
    execute the stored procedure.
    Sample C: Stored procedure created within a
    package
    Only use this sample with a native connection to Crystal Reports 9 or later.
    1. Create a table.
    CREATE TABLE Test_Table
    (ID number(5),
    Firstname varchar2(30),
    Lastname varchar2(30),
    Birthday date);
    2. Insert values into the table.
    INSERT INTO Test_Table VALUES
    (1, 'Christopher', 'Jones', '01-Nov-70');
    INSERT INTO Test_Table VALUES
    (2, 'Maria', 'Marshall', '02-Jan-77');
    INSERT INTO Test_Table VALUES
    (3, 'Jonathan', 'Campbell', '09-Aug-75');
    INSERT INTO Test_Table VALUES
    (4, 'Julie', 'Gagnon', '23-Dec-72');
    INSERT INTO Test_Table VALUES
    (5, 'Daemon', 'Thompson', '11-Feb-69');
    3. Create the Package.
    CREATE OR REPLACE PACKAGE Test_Package
    AS TYPE Test_Type IS REF CURSOR RETURN Test_Table%ROWTYPE;
    PROCEDURE Test_Procedure (
    Test_Cursor IN OUT Test_Type,
    Test_Parameter IN Test_Table.ID%TYPE
    END Test_Package;
    Crystal Reports Oracle Stored Procedures
    2/18/2004 2:55 PM Copyright © 2004 Business Objects. All rights reserved. Page 8
    cr_oracle_stored_procedures.pdf
    4. Create the Package Body (With The Code For The Stored Procedure).
    CREATE OR REPLACE PACKAGE BODY Test_Package
    AS
    PROCEDURE Test_Procedure (
    Test_Cursor IN OUT Test_Type,
    Test_Parameter IN Test_Table.ID%TYPE
    ) IS
    BEGIN
    OPEN Test_Cursor FOR
    SELECT *
    FROM Test_Table
    WHERE Test_Table.ID = Test_Parameter;
    END Test_Procedure;
    END Test_Package;
    5. Once the stored procedure is successfully created on your Oracle database,
    execute the stored procedure.

  • Problem with procedure in package

    Problem with procedure in package:
    create table accounts
    (acno number(10),
    name varchar2(20),
    balance number(10,2));
    create package banking is
    procedure new_acct(acno NUMBER, name IN VARCHAR);
    procedure acct_dep(acno IN NUMBER, amount IN NUMBER);
    procedure acc_wdr(acno IN NUMBER, amount IN NUMBER);
    procedure acc_bal(acno IN NUMBER, bal OUT NUMBER);
    function acc_drwn(acno IN NUMBER) RETURN BOOLEAN;
    end banking;
    create or replace package body banking is
    procedure new_acct ( acno IN number,
    name IN varchar) is
    begin
    insert into accounts
    (acno, name, balance)
    values
    (acno, name,0);
    end;
    procedure acct_dep(acno IN NUMBER,
    amount IN NUMBER) is
    begin
    update accounts
    set balance = balance + amount
    where acno = acno;
    end;
    procedure acc_wdr(acno IN NUMBER,
    amount IN NUMBER) is
    begin
    update accounts
    set balance = balance - amount
    where acno = acno;
    end;
    procedure acc_bal(acno IN NUMBER,
    bal OUT NUMBER) is
    begin
    declare cursor c_balance(i_acno IN accounts.acno%type) is
    select balance
    from accounts
    where acno = i_acno;
    acc_bal accounts.balance%type;
    begin
    if c_balance%isopen then
    close c_balance;
    end if;
    open c_balance(acno);
    fetch c_balance into acc_bal;
    close c_balance;
    end;
    end;
    function acc_drwn(acno IN NUMBER) RETURN BOOLEAN is
    begin
    declare cursor c_balance(i_acno IN accounts.acno%type) is
    select balance
    from accounts
    where acno = i_acno;
    bal accounts.balance%type;
    begin
    if c_balance%isopen then
    close c_balance;
    end if;
    open c_balance(acno);
    fetch c_balance into bal;
    close c_balance;
    if bal < 0 then
    return true;
    else
    return false;
    end if;
    end;
    end;
    end banking;
    begin
    banking.new_acct(123,'FRANKS');
    end;
    execute banking.acct_dep(123,100);
    execute banking.acc_wdr(123,50);
    Works fine up to this point, however when running the balance check the balance amount is not visible?
    SQL> set serveroutput on
    SQL> begin
    2 declare
    3 bal accounts.balance%type;
    4 begin
    5 banking.acc_bal(123,bal);
    6 dbms_output.put_line('Franks balance is '||bal);
    7 end;
    8 end;
    9 /

    procedure acc_bal(acno IN NUMBER,
       bal OUT NUMBER)
    is
    cursor c_balance(i_acno IN accounts.acno%type) is
       select balance
       from accounts
       where acno = i_acno;
       l_acc_bal accounts.balance%type;
    begin
       open c_balance(acno);
       fetch c_balance into l_acc_bal;
       close c_balance;
       bal := l_acc_bal;
    end;

  • How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?

    Hi 
    I have a stored procedure. It can be executed like this
    exec test @p = 1;
    exec test @p = 2
    exec test @p = n;
    n can be hundred.
    I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time.
    If I know the number in advance, say 3, I can create 3 different Execution SQL Tasks. They can be run in parallel.
    However, the n is not static. It is coming from a table. 
    How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
    I think about using script task. In the script, I get the value of n, and the list of p, from the table, then running a loop with. In the loop, I create a threat and in the threat, I execute the sp like : exec test @p = p. So the exec test may
    be run parallel. But I am not sure if it works.
    Any idea is really appreciated.

    Hi nam_man,
    According to your description, you want to call stored procedures in parallel, right?
    In SSIS, we can create separate jobs with different stored procedures, then set the same schedule to kick the jobs off at the same time. In this way, we should be careful to monitor blocking and deadlocking depending on what the jobs are doing.
    We can also put all stored procedures in SSIS Sequence container, then they will be run in parallel.
    For more information about SSIS job and Sequence container, please refer to the following documents:
    http://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/
    https://msdn.microsoft.com/en-us/library/ms139855(v=sql.110).aspx
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • How to execute a procedure depending on the result of a query?

    Hello, I'm new in ODI.
    I want to execute a procedure depending on the result of a query Oracle table.
    We have a Oracle Table whit a column that contains two possibles values.
    I want read the table, row by row, and depending on this value, execute a Procedure or execute another.
    How can i do?

    what you need to do is
    1. create a variable which "new_var2" which has the count of the number of rows you want to process. must be data type numeric.
    2. copy "new_var2" to the package screen.
    3. duplicate the "new_var2" on the package screen and evaluate the variable and test for "> 0" zero, call it "new_var2_E"
    3. create a new odi variable "new_var1" with a refresh of "select field1 fom (select field1,rownum as rownumber from tablex) where rownumber = #new_var2" in the relevant schema and technology.
    4. copy "new_var1" into your package (some where in the flow)
    5. right click the "new_var1" variable in you package screen and you should get the option duplicate step (click on that)
    6. select the the duplicate "new_var1" on the package screen and correct the the name to something meaning full to you "new_var1_E", also change the "type" to "evaluate variable" then you should see a "value" box. enter one of the values you want to test in the box (remember do not put in quotes ' )
    7. now back on the package screen join the "new_var1" to the "new_var1_E" with an OK line
    8 you now join "new_var2" to "new_var2_E" with OK
    9 you join "new_var2_E" to "new_var1"
    10. you then join the "new_var1_E" with an OK or a KO line to the relevant procedure.
    12. you need to duplicate "new_var2" in the package screen one more time this time and call it "new_var2_D" set the type to evaluate and then select the increment of -1
    13. the relevant procedure to "new_var2_D" with an OK
    14. join the "new_var2_D" to the "new_var2_E" with an OK
    15. this should close off the loop now the exit point is "new_var2_E" with a KO line to the next part of your process....
    Basically you should end up with a loop on new_var2 decementing, and it is used to get a specific next record row from your table.
    Hope this helps, sorry it is a little long winded..
    Edited by: DavidGD on Feb 8, 2009 3:29 PM

  • How to execute a procedure if out parameter is table type

    Hi,
    I need to execute a procedure, output parameter of the procedure is table type.
    Oracle version I am using is 9.2.0.8 . I am using SQL*Plus
    Procedure declaration
    PROCEDURE current_open_cycle (p_ban IN repl_cust2.billing_account.ban%TYPE,
    v_bill_seq_rec OUT bill_seq_table) ;
    Table type declaration
    TYPE bill_seq_table IS
    TABLE OF bill_seq_rectype INDEX BY BINARY_INTEGER ;
    TYPE bill_seq_rectype IS RECORD (v_cycle_run_year repl_cust2.bill.cycle_run_year%TYPE,
    v_cycle_run_month repl_cust2.bill.cycle_run_month%TYPE,
    v_cycle_code repl_cust2.bill.cycle_code%TYPE,
    v_open_cycle BOOLEAN, -- An open cycle
    v_billed_cycle BOOLEAN, --
    v_invoice_number VARCHAR2(13),
    v_start_date DATE,
    v_end_date DATE,
    v_root_ban repl_cust2.bill.root_ban%TYPE) ;
    I tried executing using this script, but it failed. When I execute this oracle lost connection to data base.
    declare
    r_bill_seq_rec ss_invoice_utilities.bill_seq_table;
    begin
    ss_invoice_utilities.current_open_cycle(934018003,r_bill_seq_rec);
    end;
    Please help me how I should write declare block to execute this procedure and also print output of the procedure.
    Regards
    Raghu

    I don't see anything wrong with the anonymous block, assuming ss_invoice_utilities is the correct package name. Perhaps a simplified test case would show up what's not working there.
    As for printing the contents of an associative array, you'll have to write some code to loop through it and construct a string per row to output via dbms_output, assuming the text will fit within dbms_output's size restrictions in 9i. dbms_output is a debugging tool though - is that the requirement?
    btw "pls_integer" is less to type than "binary_integer" ;)
    Edited by: William Robertson on Apr 16, 2009 8:35 AM

  • We are not able to execute below procedure, plz help me ASAP.

    Dear All
    I am created one procedure with 4 parameter 1 is Ref Cusrsor rest of 3 are Varchar,But we are not able to execute below procedure, plz help me ASAP.
    CREATE OR REPLACE PROCEDURE GETCHART(RPT_CURSOR OUT RPT_PACKAGE.RPT_RESULTS,
    V_VITALCHARTING VARCHAR2,
    V_DOCIDPATIENTS VARCHAR2,
    v_fromdate varchar2,
    v_todate varchar2) AS
    D1 VARCHAR2(500);
    D2 VARCHAR2(500);
    G1 VARCHAR2(500);
    R1 VARCHAR2(500);
    R2 VARCHAR2(500);
    R3 VARCHAR2(500);
    R4 VARCHAR2(500);
    R5 VARCHAR2(500);
    H1 VARCHAR2(500);
    H2 VARCHAR2(500);
    V_COUNT NUMBER;
    RC VARCHAR2(100);
    RMI VARCHAR2(100);
    RMAX VARCHAR2(100);
    R12 VARCHAR2(500);
    REQ NUMBER;
    V_MAX number;
    v_idcount number;
    RSEQ NUMBER;
    RCH VARCHAR2(500);
    BEGIN
    INSERT INTO TEMPDATA
    SELECT ROWNUM G, TIME1
    FROM (SELECT distinct TO_CHAR(H.RECORDEDDNT, 'mm/dd/yy hh24:mi:ss') TIME1
    FROM VIEW_PATIENTCHART V,
    chartingtxheader H,
    chartingtxdetails D
    WHERE h.docid = d.docidchartingtxheader
    and v.VITALCHARTING_PK = h.docidvitalcharting
    and v.VITALPARAMETER_PK = d.docidvitalparameter
    and v.VITALCHARTING_PK = V_VITALCHARTING --General Vital Signs
    and H.DOCIDPATIENTS = V_DOCIDPATIENTS
    and TO_DATE(to_char(h.recordeddnt, 'DD/MM/YYYY'),
    'DD/MM/YYYY') BETWEEN
    TO_DATE(v_fromdate, 'DD/MM/YYYY') AND
    TO_DATE(V_TODATE, 'DD/MM/YYYY'));
    SELECT MAX(ID) INTO V_MAX FROM TEMPDATA;
    V_IDCOUNT := 0;
    WHILE V_IDCOUNT < V_MAX loop
    FOR J IN (SELECT id, ROWNUM G, vdate time1
    FROM (SELECT id, ROWNUM, VDATE
    FROM TEMPDATA
    WHERE ID BETWEEN V_IDCOUNT + 1 AND V_IDCOUNT + 8)) LOOP
    D1 := D1 || 'COL' || J.G || ',';
    D2 := D2 || '''' || J.TIME1 || '''' || ',';
    END LOOP;
    D1 := SUBSTR(D1, 1, LENGTH(D1) - 1);
    D2 := SUBSTR(D2, 1, LENGTH(D2) - 1);
    DBMS_OUTPUT.PUT_LINE(d1);
    SELECT SEQ_GETCHART.NEXTVAL INTO RSEQ FROM DUAL;
    G1 := 'INSERT INTO GETDATA2 (IDSLNO,idcount,' || D1 || ') VALUES(' || RSEQ || ',' ||
    V_IDCOUNT || ',' || D2 || ')';
    --EXECUTE IMMEDIATE G1;
    DBMS_OUTPUT.PUT_LINE(d1);
    DBMS_OUTPUT.PUT_LINE(SUBSTR(D2, 1, LENGTH(D2) - 1));
    DBMS_OUTPUT.PUT_LINE(G1);
    EXECUTE IMMEDIATE G1;
    FOR K IN (SELECT id, ROWNUM G, vdate time2
    FROM (SELECT id, ROWNUM, VDATE
    FROM TEMPDATA
    WHERE ID BETWEEN V_IDCOUNT + 1 AND V_IDCOUNT + 8)) LOOP
    FOR I IN (select s.*, rownum hslno
    from (SELECT v.CHARTNAME,
    v.PARAMETERNAME_CS,
    ' ' || v.PARAMETERNAME PARAMETERNAME,
    TO_CHAR(H.recordeddnt, 'mm/dd/yy hh24:mi:ss') TIME1,
    CASE
    WHEN IDSLNO_GN5029 IN (1040, 1041) THEN
    CASE
    WHEN TO_NUMBER(d.recordedvalue) <
    TO_NUMBER(D.MINVALUE) THEN
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'L')
    ELSE
    CASE
    WHEN TO_NUMBER(d.recordedvalue) >
    TO_NUMBER(D.MaxVALUE) THEN
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'H')
    ELSE
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'N')
    END END ELSE d.recordedvalue END IMAGECHAR,
    d.minvalue,
    d.maxvalue,
    D.UOMCODE
    FROM VIEW_PATIENTCHART V,
    chartingtxheader H,
    chartingtxdetails D
    WHERE h.docid = d.docidchartingtxheader
    and v.VITALCHARTING_PK = h.docidvitalcharting
    and v.VITALPARAMETER_PK = d.docidvitalparameter
    and v.VITALCHARTING_PK = V_VITALCHARTING --General Vital Signs
    and H.DOCIDPATIENTS = V_DOCIDPATIENTS
    ORDER BY V.DISPLAYORDER_CS, V.DISPLAYORDER
    -- v.PARAMETERNAME_CS,v.PARAMETERNAME
    ) s
    where s.time1 = k.time2) LOOP
    select count(1)
    into v_count
    from GETDATA2 d
    where d.PARAMETERNAME_CS = i.PARAMETERNAME_CS
    and PARAMETERNAME = i.PARAMETERNAME
    and idcount = v_idcount;
    IF V_COUNT = 0 THEN
    RCH := I.CHARTNAME;
    R1 := 'COL' || K.G;
    R2 := '''' || I.PARAMETERNAME_CS || '''' || ',';
    R3 := '''' || I.PARAMETERNAME || '''' || ',';
    R4 := '''' || I.IMAGECHAR || '''';
    RC := '''' || I.CHARTNAME || '''' || ',';
    RMI := '''' || I.minvalue || '''' || ',';
    RMAX := '''' || I.maxvalue || '''' || ',';
    R12 := '''' || I.UOMCODE || '''' || ',';
    SELECT SEQ_GETCHART.NEXTVAL INTO RSEQ FROM DUAL;
    H1 := 'INSERT INTO GETDATA2 (IDSLNO,UMCODE,idcount,CHARTNAME,minvalue,maxvalue,PARAMETERNAME_CS,PARAMETERNAME,' || R1 || ')' ||
    ' values(' || RSEQ || ',' || R12 || v_idcount || ',' || RC || RMI || RMAX || R2 || R3 || R4 || ')';
    EXECUTE IMMEDIATE H1;
    ELSE
    R5 := 'COL' || K.G;
    R4 := '''' || I.IMAGECHAR || '''';
    H2 := 'UPDATE GETDATA2 SET ' || R5 || '=' || R4 ||
    'WHERE PARAMETERNAME_CS=' || '''' || I.PARAMETERNAME_CS || '''' ||
    ' AND ' || 'PARAMETERNAME=' || '''' || I.PARAMETERNAME || '''';
    EXECUTE IMMEDIATE H2;
    END IF;
    END LOOP;
    end loop;
    UPDATE getdata2 s
    set s.parametername = s.parametername || ' -' || ' (' || minvalue ||
    ' -- ' || maxvalue || ') ' || UMCODE
    where s.parametername is not null
    and idcount = v_idcount
    and minvalue != 0
    and maxvalue != 0;
    UPDATE getdata2 s
    set s.parametername = s.parametername || ' -' || UMCODE
    where s.parametername is not null
    and idcount = v_idcount
    and minvalue = 0
    and maxvalue = 0;
    UPDATE GETDATA2 S
    SET S.PARAMETERNAME_CS = NULL
    WHERE ROWID NOT IN (SELECT MIN(ROWID)
    FROM GETDATA2
    WHERE idcount = v_idcount
    GROUP BY PARAMETERNAME_CS)
    and idcount = v_idcount;
    UPDATE GETDATA2 S
    SET CHARTNAME = NULL
    WHERE ROWID NOT IN (SELECT MIN(ROWID)
    FROM GETDATA2
    WHERE idcount = v_idcount
    GROUP BY CHARTNAME)
    and idcount = v_idcount;
    UPDATE getdata2 s
    set s.parametername = ' PARAMETER'
    where s.parametername is null
    AND S.PARAMETERNAME_CS IS NULL;
    v_idcount := v_idcount + 8;
    D1 := null;
    d2 := null;
    end loop;
    for i in (SELECT G.PARAMETERNAME_CS, G.IDSLNO
    FROM GETDATA2 G
    WHERE G.PARAMETERNAME_CS IS NOT NULL) LOOP
    INSERT INTO GETDATA2
    (IDSLNO, PARAMETERNAME)
    VALUES
    (I.IDSLNO - 1 + 0.5, I.PARAMETERNAME_CS);
    END LOOP;
    update GETDATA2 h set h.PARAMETERNAME_CS = null;
    update GETDATA2 h set h.chartname = rcH;
    INSERT INTO GETDATA1
    SELECT CHARTNAME,
    PARAMETERNAME_CS,
    PARAMETERNAME,
    COL1,
    COL2,
    COL3,
    COL4,
    COL5,
    COL6,
    COL7,
    COL8,
    COL9,
    COL10,
    MINVALUE,
    MAXVALUE,
    UMCODE
    FROM GETDATA2
    ORDER BY IDSLNO;
    OPEN RPT_CURSOR FOR
    SELECT * FROM GETDATA1;
    END;
    CREATE OR REPLACE PACKAGE "RPT_PACKAGE"
    as
    type RPT_RESULTS is REF CURSOR;
    type RPT_VARRAY is VARRAY(2000) of VARCHAR2(2000);
    END RPT_PACKAGE;
    Execute
    declare
    type my_newcursor IS REF CURSOR;
    begin
    GETCHART(my_newcursor,'General Vital Sign','1145561',sysdate-1,sysdate);
    end;

    Parwez wrote:
    Dear All
    I am created one procedure with 4 parameter 1 is Ref Cusrsor rest of 3 are Varchar,But we are not able to execute below procedure, plz help me ASAP.
    see a picture of my car.
    my car won't go.
    tell me how to make my car go.
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Help....on stored procedure (or package)

    Hi,
    I have any problem to create stored procedure in Oracle, Can you help me?
    I have to create a stored procedure (or package) in order to reserve the free rooms to the students in the period comprised between the DATE_START and DATE_END.
    Table of the present rooms in building BL1 (RM): SEX 1 = M - SEX 2 = F SEX = 0 (ROOM WITHOUT SEX)
    BL_ID.....FL_ID.......RM_ID.........SEX......RM_STD.....RM_CAT
    BL1.........1..........101..............1........S........ROOM
    BL1.........1..........102..............0........D........ROOM
    BL1.........1..........103..............2........T........ROOM
    BL1.........2..........201..............2........S........ROOM
    BL1.........2..........202..............1........D........ROOM
    BL1.........2..........203..............1........T........ROOM
    BL1.........3..........301..............2........S........APARTMENT
    BL1.........3..........302..............2........D........APARTMENT
    BL1.........3..........303..............1........T........APARTMENT
    BL1.........3..........304..............1........D........APARTMENT
    BL1.........3..........305..............0........D........APARTMENT
    Table of the students (EM):
    EM_ID...........BL_ID.......FL_ID........RM_ID........COD_STUD
    SABRINA..........BL1..........1............102.........524505
    TAKEM............BL1..........1............103.........569673
    SERAFINO.........BL1..........1............103.........589920
    STELLA...........BL1..........1............102.........574659
    CHIARA...........BL1..........1............101.........587845
    VIDAL............BL1..........1............102.........602877
    ROSARIA..........BL1..........2............202.........517070
    LUCA.............BL1..........2............201.........602743
    DANIELA..........BL1..........2............203.........602865
    ANNAMARIA........BL1..........3............305.........588721
    LUIGI............BL1..........3............304.........546517
    Type of rooms (RM_STD):
    RM_STD.......STD_EM........DESCRIPTION
    D.............4..............DOUBLE
    T.............6..............TRIPLE
    S.............2..............SINGLE
    Tables of the reservations carried out from the students (RMPCT):
    EM_ID......BL_ID........FL_ID......RM_ID......DATE_START.......DATE_END.......COD_STUD
    CHIARA......BL1.........1..........101.......11/02/2004.......12/02/2004.......587845
    CHIARA......BL1.........1..........101.......03/02/2005.......16/02/2005.......587845
    SERAFINO....BL1.........1..........102.......12/02/2004.......19/02/2004.......589920
    VIDAL.......BL1.........1..........102.......16/02/2004.......01/03/2004.......602877
    SERAFINO....BL1.........1..........103.......01/02/2004.......15/02/2004.......589920
    TAKEM.......BL1.........1..........103.......04/02/2005.......10/02/2005.......569673
    LUCA........BL1.........2..........201.......03/02/2005.......23/02/2005.......602743
    ROSARIA.....BL1.........2..........202.......03/02/2005.......16/02/2005.......517070
    DANIELA.....BL1.........2..........203.......03/02/2005.......04/02/2005.......602865
    LUIGI.......BL1.........3..........301.......03/02/2005.......23/02/2005.......546517
    VALERIA.....BL1.........3..........302.......12/02/2004.......16/02/2004.......515348
    CHIARA......BL1.........3..........302.......05/02/2004.......15/02/2004.......587845
    CHIARA......BL1.........3..........304.......10/02/2004.......12/02/2004.......587845
    CHIARA......BL1.........3..........305.......20/01/2004.......04/02/2004.......587845
    ANNAMARIA...BL1.........3..........305.......03/02/2005.......16/02/2005.......588721
    INPUT PARAMETERS:
    CREATE OR REPLACE Procedure RESERVE_ROOMS (stud_name varchar2,
    cod_stud varchar2,
    bl_in varchar2,
    fl_in varchar2,
    rm_in in varchar2,
    sex_in varchar2,
    date_start_in varchar2,
    date_end_in varchar2)
    CONDITIONS:
    verify if there are students in table EM:
    select count (1)
    into v_appo
    from em
    where em_id = stud_name
    and cod_stud = cod_stud;
    if v_appo = 0 then
    insert new student:
              insert into em (em_id,cod_sud,sex)
    values (stud_name,cod_stud,sex_in);
    Now I must verify the free rooms in the period comprised between the DATE_START_IN and DATE_END_IN.
    I tried this query: (seem correct...have you any idea?)
    select bl_id,fl_id,rm_id,RM_STD
    from rm
    where (bl_id,fl_id,rm_id,RM_STD) not in (select a.bl_id,a.fl_id,a.rm_id,A.RM_STD
                             from rm a, rmpct b
                             where a.bl_id=b.bl_id
                             and a.fl_id=b.fl_id
                             and a.rm_id=b.rm_id
                             AND((b.date_start <= TO_DATE(date_start_in, 'dd-mm-YYYY')
                             AND b.date_end >= TO_DATE(date_end_in, 'dd-mm-YYYY'))
                             OR ( b.date_end <= TO_DATE(date_end_in, 'dd-mm-YYYY'))
                             AND b.date_end >= TO_DATE(date_start_in, 'dd-mm-YYYY')
                             OR ( b.date_start >= TO_DATE(date_start_in, 'dd-mm-YYYY')
                             and b.date_start <= TO_DATE(date_end_in, 'dd-mm-YYYY')
                             AND b.date_end >= TO_DATE(date_end_in, 'dd-mm-YYYY'))))
    with this query I get all free rooms in period date_start_in - date_end_in, but I must,also,verify if there are double or triple rooms (reserved) with minus of 2 (double) or minus of 3 (triple) students. If there are I can reserved these rooms.
    I tried to verify with these steps:
    CREATE OR REPLACE VIEW COUNT_EM ( BL_ID,
    FL_ID, RM_ID, NUMBER_EM ) AS
    (SELECT rm.bl_id, rm.fl_id, rm.rm_id, COUNT(*) as numero_em
    FROM em, rm
    WHERE em.bl_id(+) = rm.bl_id
    AND em.fl_id(+) = rm.fl_id
    AND em.rm_id(+) = rm.rm_id
    and rm.rm_std in ('S', 'D', 'T')
    group by rm.bl_id, rm.fl_id, rm.rm_id)
    CREATE OR REPLACE VIEW COUNT_RMPCT ( BL_ID,
    FL_ID, RM_ID, STD_EM, NUMBER_RMPCT
    ) AS
    SELECT rm.bl_id, rm.fl_id, rm.rm_id, rmstd.std_em, COUNT(*) as numero_rmpct
    FROM rm, rmpct,rmstd
    WHERE rmpct.bl_id(+) = rm.bl_id
    AND rmpct.fl_id(+) = rm.fl_id
    AND rmpct.rm_id(+) = rm.rm_id
    and rm.rm_std=rmstd.rm_std
    and rm.rm_std in ('S', 'D', 'T')
    AND((rmpct.date_start <= TO_DATE(date_start_in', 'dd-mm-YYYY')
    AND rmpct.date_end >= TO_DATE(date_end_in, 'dd-mm-YYYY'))
    OR ( rmpct.date_end <= TO_DATE(date_end_in, 'dd-mm-YYYY'))
    AND rmpct.date_end >= TO_DATE(date_start_in, 'dd-mm-YYYY')
    OR ( rmpct.date_start >= TO_DATE(date_start_in, 'dd-mm-YYYY')
    and rmpct.date_start <= TO_DATE(date_end_in, 'dd-mm-YYYY')
    AND rmpct.date_end >= TO_DATE(date_end_in, 'dd-mm-YYYY')))
    group by rm.bl_id, rm.fl_id, rm.rm_id, rmstd.std_em
    AND FINALLY:
    select a.bl_id, a.fl_id, a.rm_id, a.NUMBER_RMPCT, B.NUMBER_EM, a.std_em, (a.std_em - (a.NUMBER_RMPCT+B.NUMBER_EM)) RM_FREE
    from COUNT_RMPCT a, COUNT_EM b
    where a.bl_id=b.bl_id
    and a.fl_id=b.fl_id
    and a.rm_id=b.rm_id
    if RM_FREE > 0 THEN there are free rooms (D or T) between those occupied in that period.
    Now If the room (bl_in,fl_in,rm_in) is free I can reserve inserting it in the table RMPCT:
    INSERT INTO rmpct (bl_id, fl_id, rm_id,em_id,cod_stud,date_start, date_end)
    values(bl_in,fl_in,rm_in,stud_name,cod_stud,date_start_in,date_end_in);
    If I haven't rm_in (can be null) I must reserve the first free room (random).
    after these controls: I update table of the students:
    UPDATE em
    Set bl_id = BL_IN,fl_id= FL_IN,rm_id=rm_in
         where em_id=stud_name
         and cod_stud=cod_stud;
    Finally I must make a control on the sex of the room, because there are rooms that have sex=0
    if RM.SEX <> 0 then
         null
    else
    if rm_cat = 'ROOM' then
    UPDATE rm
    set sex = sex_in
    where bl_id = in
    and fl_id = in
    and rm_id = in;
    if rm_cat = 'APARTMENT' then (update on all rooms)
    UPDATE rm
    set sex = sex_in
    where bl_id = in
    and fl_id = in;
    IF v_appo > 0 then
         Same controls except:      insert into em (em_id,cod_sud,sex)
                   values (stud_name,cod_stud,sex_in);
    How I can insert in one stored procedure (or package) all these instructions and controls?
    Thanks in advance!

    In the following demonstation, I have changed the names of some of your variables, in order to standardize them. I have prefaced input parameters with p_ and local variables with v_ and followed them with the name of the column that they are associated with when appropriate. This avoids conflicts with any column names and makes the code easier to read and follow. I have also used table_name.column_name%type to specify the data type associated with the variables instead of using varchar2. That way, if the data type of the columns changes, the code does not have to be updated. This is standard practice.
    In your first insert statement, you have attempted to insert sex into the em table, but there is no sex column in the em table data that you displayed, so I removed the sex.
    Instead of using a complicated mess of views and such to check whether there is a room available and then assign it, I have used just one select statement to select an available room and used an exception clause that handles a no_data_found exception to deal with when there is no room available.
    I have greatly simplified your checking of dates within that select statement.
    You were on the right track with the outer joins and grouping and checking for single, double, or triple rooms. Instead of count, I have used sum and nvl2, so that only the occupied rooms are counted and the rows generated by the outer join are zeroes.
    I have used the nvl function to allow for null values in the input parameters, so that any room can be selected. I used dbms_random.random to ensure that the rows are ordered randomly, but you can leave that out if it is really not that critical that the result be truly random and any row will do. I have used rownum=1 in an outer query to select just one row.
    When you select from a table in pl/sql, you have to select into something. You cannot just issue a select statement, then use an if statement to compare some value in the select statement. For example, you cannot use "if rm.sex ..." you have to select rm.sex into a variable, like v_sex, then use "if v_sex ...". So, I have selected the result of the select statement into local variables, then used those variables for comparisons. I have also used those variables for inserting and updating the appropriate tables, rather than just using the original input parameters, since some of them may have been null.
    In the example below, I have demonstrated how the procedure rejects an unavailable room, accepts a specific available room, and randomly assigns a room.
    -- procedure:
    scott@ORA92> CREATE OR REPLACE PROCEDURE reserve_rooms
      2    -- input parameters:
      3    (p_em_id      IN em.em_id%TYPE,
      4       p_cod_stud   IN em.cod_stud%TYPE,
      5       p_bl_id      IN rm.bl_id%TYPE,
      6       p_fl_id      IN rm.fl_id%TYPE,
      7       p_rm_id      IN rm.rm_id%TYPE,
      8       p_sex          IN rm.sex%TYPE,
      9       p_date_start IN VARCHAR2,
    10       p_date_end   IN VARCHAR2)
    11  AS
    12    -- local variables:
    13    v_appo          INTEGER;
    14    v_bl_id          rm.bl_id%TYPE;
    15    v_fl_id          rm.fl_id%TYPE;
    16    v_rm_id          rm.rm_id%TYPE;
    17    v_rm_cat      rm.rm_cat%TYPE;
    18    v_sex          rm.sex%TYPE;
    19  BEGIN
    20    -- verify if the student is in table em:
    21    SELECT COUNT (*)
    22    INTO   v_appo
    23    FROM   em
    24    WHERE  em_id = p_em_id
    25    AND    cod_stud = p_cod_stud;
    26    -- if the student is not in table em, then insert new student:
    27    IF v_appo = 0 THEN
    28        INSERT INTO em (em_id, cod_stud)
    29        VALUES (p_em_id, p_cod_stud);
    30    END IF;
    31    BEGIN
    32        -- find available room:
    33        SELECT bl_id, fl_id, rm_id, sex, rm_cat
    34        INTO     v_bl_id, v_fl_id, v_rm_id, v_sex, v_rm_cat
    35        FROM     (SELECT rm.bl_id, rm.fl_id, rm.rm_id, rm.sex, rm.rm_cat
    36             FROM     rmpct, rm
    37             WHERE     rm.bl_id = rmpct.bl_id (+)
    38             AND     rm.fl_id = rmpct.fl_id (+)
    39             AND     rm.rm_id = rmpct.rm_id (+)
    40             AND     rm.bl_id = NVL (p_bl_id, rm.bl_id)
    41             AND     rm.fl_id = NVL (p_fl_id, rm.fl_id)
    42             AND     rm.rm_id = NVL (p_rm_id, rm.rm_id)
    43             AND     (rm.sex   = p_sex OR rm.sex = 0)
    44             AND     rmpct.date_start (+) <= TO_DATE (p_date_end, 'DD-MM-YYYY')
    45             AND     rmpct.date_end (+) >= TO_DATE (p_date_start, 'DD-MM-YYYY')
    46             GROUP     BY rm.bl_id, rm.fl_id, rm.rm_id, rm.sex, rm.rm_cat, rm.rm_std
    47             HAVING SUM (NVL2 (rmpct.rm_id (+), 1, 0))
    48                 < DECODE (rm_std, 'S', 1, 'D', 2, 'T', 3)
    49             ORDER     BY DBMS_RANDOM.RANDOM)
    50        WHERE ROWNUM = 1;
    51        -- reserve room:
    52        INSERT INTO rmpct (bl_id, fl_id, rm_id, em_id, cod_stud, date_start, date_end)
    53        VALUES (v_bl_id, v_fl_id, v_rm_id, p_em_id, p_cod_stud,
    54             TO_DATE (p_date_start, 'DD-MM-YYYY'),
    55             TO_DATE (p_date_end, 'DD-MM-YYYY'));
    56        -- update students:
    57        UPDATE em
    58        SET     bl_id = v_bl_id, fl_id = v_fl_id, rm_id = v_rm_id
    59        WHERE     em_id = p_em_id
    60        AND     cod_stud = p_cod_stud;
    61        -- update sex of room or apartment floor:
    62        IF v_sex = 0 THEN
    63          IF v_rm_cat = 'ROOM' THEN
    64            UPDATE rm
    65            SET    sex = p_sex
    66            WHERE  bl_id = v_bl_id
    67            AND    fl_id = v_fl_id
    68            AND    rm_id = v_rm_id;
    69          ELSIF v_rm_cat = 'APARTMENT' THEN
    70            UPDATE rm
    71            SET    sex = p_sex
    72            WHERE  bl_id = v_bl_id
    73            AND    fl_id = v_fl_id;
    74          END IF;
    75        END IF;
    76    EXCEPTION
    77        -- if no room is available:
    78        WHEN NO_DATA_FOUND THEN
    79          RAISE_APPLICATION_ERROR (-20001, 'Sorry, there is no such room available.');
    80    END;
    81  END reserve_rooms;
    82  /
    Procedure created.
    scott@ORA92> SHOW ERRORS
    No errors.
    -- rejects unavailable room of wrong sex:
    scott@ORA92> EXECUTE reserve_rooms ('BARBARA', 654321, 'BL1', 1, 101, 2, '04-02-2005', '10-02-2005')
    BEGIN reserve_rooms ('BARBARA', 654321, 'BL1', 1, 101, 2, '04-02-2005', '10-02-2005'); END;
    ERROR at line 1:
    ORA-20001: Sorry, there is no such room available.
    ORA-06512: at "SCOTT.RESERVE_ROOMS", line 79
    ORA-06512: at line 1
    -- accepts available room of same sex:
    scott@ORA92> EXECUTE reserve_rooms ('BARBARA', 654321, 'BL1', 1, 103, 2, '04-02-2005', '10-02-2005')
    PL/SQL procedure successfully completed.
    -- assigns random available room of same or no sex:
    scott@ORA92> EXECUTE reserve_rooms ('BARBARA', 654321, NULL, NULL, NULL, 2, '11-02-2005', '23-02-2005')
    PL/SQL procedure successfully completed.
    -- results:
    scott@ORA92> -- one and only one row added to em table:
    scott@ORA92> SELECT * FROM em WHERE em_id = 'BARBARA'
      2  /
    EM_ID           BL_I      FL_ID      RM_ID   COD_STUD
    BARBARA         BL1           1        102     654321
    scott@ORA92> -- rooms reserved and other people who have reserved same room
    scott@ORA92> -- (there are 3 who reserved a double room, but only 2 at a time):
    scott@ORA92> SELECT *
      2  FROM   rmpct
      3  WHERE  (bl_id, fl_id, rm_id) IN
      4           (SELECT bl_id, fl_id, rm_id
      5            FROM   rmpct
      6            where  em_id = 'BARBARA')
      7  /
    EM_ID           BL_      FL_ID      RM_ID DATE_STAR DATE_END    COD_STUD
    BARBARA         BL1          1        102 11-FEB-05 23-FEB-05     654321
    SERAFINO        BL1          1        102 12-FEB-04 19-FEB-04     589920
    VIDAL           BL1          1        102 16-FEB-04 01-MAR-04     602877
    SERAFINO        BL1          1        103 01-FEB-04 15-FEB-04     589920
    TAKEM           BL1          1        103 04-FEB-05 10-FEB-05     569673
    BARBARA         BL1          1        103 04-FEB-05 10-FEB-05     654321
    6 rows selected.
    scott@ORA92> -- rooms reserved are all correct sex
    scott@ORA92> -- (note that room 102 was updated from 0 to 2):
    scott@ORA92> SELECT *
      2  FROM   rm
      3  WHERE  (bl_id, fl_id, rm_id) IN
      4           (SELECT bl_id, fl_id, rm_id
      5            FROM   rmpct
      6            where  em_id = 'BARBARA')
      7  /
    BL_      FL_ID      RM_ID        SEX R RM_CAT
    BL1          1        102          2 D ROOM
    BL1          1        103          2 T ROOM
    scott@ORA92>

  • Why doesn't the "grant execute any procedure" work?

    Hi to all.
    I want to grant the execute privilege for all SYS schema functions/procedures. To achieve it I do the following:
    SQL> connect sys/*****@orcl
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as SYS
    SQL> create user test identified by test;
    User created
    SQL> grant create session to test;
    Grant succeeded
    SQL> grant execute any procedure to test;
    Grant succeeded
    According to the [http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9013.htm] the "grant execute any procedure" - grants Execute procedures or functions, either standalone or packaged.
    So, the steps seem to be right. Then, I try to connect to the test user and execute any procedure from the SYS schema, for example, dbms_lock.sleep:
    SQL> connect test/test@dizzy/orcl
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as test
    SQL> begin
    2 sys.dbms_lock.sleep(1);
    3 end;
    4 /
    begin
    sys.dbms_lock.sleep(1);
    end;
    ORA-06550: line 3, column 1:
    PLS-00201: identifier 'SYS.DBMS_LOCK' must be declared
    ORA-06550: line 3, column 1:
    PL/SQL: Statement ignored
    So, the execution fails due to insufficient rights. However, the direct grant on the sys.dbms_lock works!
    SQL> connect sys/*****@dizzy/orcl as sysdba
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as SYS
    SQL> grant execute on dbms_lock; to test;
    grant execute on dbms_lock; to test
    ORA-00911: invalid character
    SQL> grant execute on dbms_lock to test;
    Grant succeeded
    SQL> connect test/test@dizzy/orcl
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as test
    SQL> begin
    2 sys.dbms_lock.sleep(1);
    3 end;
    4 /
    PL/SQL procedure successfully completed
    So, to be sure that the grant on any procedure from the definite scheme is given, should I avoid giving the execute any procedure grant?
    P.S. Is there any special tag for code?
    Thanks in advance.

    Sybrand, thank you for the reply.
    You are right. I tried to connect by another user NOT SYS and created the function:
    SQL> create user testic identified by i;
    User created
    SQL> grant create session, execute any procedure to testic;
    Grant succeeded
    SQL> create or replace function get1 return number is
      2  begin
      3  return 1;
      4  end;
      5  /
    Function created
    SQL> connect testic/i@orcl
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as testic
    SQL> select get1 from dual;
    select get1 from dual
    ORA-00904: "GET1": invalid identifier
    SQL> select kaisa_rgali.get1 from dual;
          GET1
             1Thank you for the tag. This's exactly what I asked about.
    Finally, I tried t open the hyperlink http://download.oracle.com/docgs/cd/B10501_01/server.920/a96521/privs.htm but it failed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Apex 4 error ORA-04042 procedure, function, package body does not exist

    Hi all,
    I was instaling Oracle Application Expres 10g on Linux ubuntu and I was download and unzip apex 4
    on /usr/lib/oracle/xe/
    then connect as SYS as sysdba with pass and
    start
    @/usr/lib/oracle/xe/apex/apexins SYSAUX SYSAUX TEMP /i/
    installation starting
    ... after 5 minutes theres end of log file>
    I. O R A C L E S Y S I N S T A L L P R O C E S S
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/dev_grants.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/core_grants.sql"
    ...CONNECT as the Oracle user who will own the APEX engine
    Session altered.
    III. I N S T A L L A P E X P A C K A G E S P E C S
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_plsql_editor.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_model_api.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_f4000_util.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_plugin_f4000.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_image_generator.sql"
    Installing Team Development objects
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/team_tab.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_team.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_team_api.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_team_gen_api.sql"
    Installing Application Migration Workshop objects
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_create_ddl.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_create_ddl.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_exporter_ins.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/mig_views.sql"
    ...installing Application Migration Workshop package spec
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_acc_load.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_load_xml.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_olb_load_xml.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_update_apx_app.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_utilities.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frmmenu_load_xml.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_rpt_load_xml.sql"
    ...install Application Migration Workshop package body
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_acc_load.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_load_xml.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_olb_load_xml.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_update_apx_app.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frm_utilities.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_frmmenu_load_xml.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_mig_rpt_load_xml.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_item_comps.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_translation_utilities.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/copy.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/copy_lov.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/copy_item.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/copy_button.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_translation_utilities.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/seed.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/sync.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/layout.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_lov_used_on_pages.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_query_builder.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_sw_object_feed.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_load_data.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_load_excel_data.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/copy_metadata.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/copyu.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_tab_mgr.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/generate_ddl.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/table_drill.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_download.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_copy_page.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/generate_table_api.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_gen_hint.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_xliff.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_create_model_app.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/apex_admin.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_help.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_data_quick_flow.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_theme_files.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_session_mon.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_sw_page_calls.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_wiz_confirm.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_page_map.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_drag_layout.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_dataload_xml.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/apex_ui_default_update.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/apex_mig_projects_update.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_install_wizard.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_dictionary.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_advisor.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_search.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_f4000_plugins.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_4000_ui.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_4050_ui.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_workspace_reports.sql"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_f4000_p4150.sql"
    timing for: Development Package Specs
    Elapsed: 00:00:00.02
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_plsql_editor.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_model_api.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_f4000_util.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_plugin_f4000.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_image_generator.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/layout.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_query_builder.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_sw_object_feed.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_load_data.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_load_excel_data.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/copy_metadata.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/copyu.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_tab_mgr.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/generate_ddl.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/table_drill.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_download.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_copy_page.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/generate_table_api.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_gen_hint.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_translation_utilities.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_xliff.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_create_model_app.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_help.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_data_quick_flow.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_theme_files.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_session_mon.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_sw_page_calls.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_wiz_confirm.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_page_map.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_drag_layout.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_dataload_xml.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/apex_ui_default_update.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/apex_mig_projects_update.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_install_wizard.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_dictionary.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_advisor.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_search.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_f4000_plugins.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_4000_ui.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_4050_ui.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_translation_utilities.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_team.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_team_api.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_team_gen_api.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_workspace_reports.plb"
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_flow_f4000_p4150.plb"
    ...install demonstration Oracle APEX application package specs
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/collections_showcase.sql"
    ...install demonstration Oracle APEX application package bodies
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/collections_showcase.plb"
    ...install demonstration tables
    SP2-0310: unable to open file "/usr/lib/oracle/xe/apex/coreinscore/wwv_demo_tab.sql"
    timing for: Development Package Bodies
    Elapsed: 00:00:00.03
    grant execute on wwv_mig_acc_load to public
    ERROR at line 1:
    ORA-04042: procedure, function, package, or package body does not exist
    is there any solution?
    regards
    Gordan

    Install 4.0 pass ok!
    1. I was changing apexins.sql
    as PREFIX='@/usr/lib/oracle/xe/apex/'
    and add path to coreins.sql as @/usr/lib/oracle/xe/apex/coreins.sql
    2. create two folders coreinscore and coreinsbuild and copy all files from folder core and folder build
    3. copy and rename endins.sql as coreinsendins.sql
    after 10 min instalation pass ok!
    Gordan
    Edited by: useruseruser on Jun 29, 2010 2:12 PM

Maybe you are looking for