Executing procedure in package problem

Hi, i have a procedure called Newcar. i have now created a package and put the Newcar procedure inside the package body. but when i want to invoke it (to put data) by running execute packageTest.Newcar('Ferrari', 007) i get ORA-00900: invallid sql statement. what is wrong? the package spec and body gets created ok:
CREATE OR REPLACE PACKAGE packageTest IS
PROCEDURE Newcar(vname IN VARCHAR2, vreg IN NUMBER);
END packageTest;
CREATE OR REPLACE PACKAGE BODY packageTest IS
PROCEDURE Newcar
(vname IN VARCHAR2, vreg IN NUMBER)
IS
l_vreg NUMBER;
BEGIN
l_vreg := vreg;
IF vreg > 999 THEN
l_vreg := 999;
END IF;
INSERT INTO CARS (carname, carreg)
VALUES
(vname, l_vreg);
END Newcar;
END packageTest;
/

Worked for me. Are there other details that might be relevant? The table definition perhaps? Triggers? Can you post similar output from your SQL*Plus session?
SQL> CREATE OR REPLACE PACKAGE packageTest IS
  2  PROCEDURE Newcar(vname IN VARCHAR2, vreg IN NUMBER);
  3  END packageTest;
  4  /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY packageTest IS
  2  PROCEDURE Newcar
  3  (vname IN VARCHAR2, vreg IN NUMBER)
  4  IS
  5  l_vreg NUMBER;
  6  BEGIN
  7  l_vreg := vreg;
  8  IF vreg > 999 THEN
  9  l_vreg := 999;
10  END IF;
11
12  INSERT INTO CARS (carname, carreg)
13  VALUES
14  (vname, l_vreg);
15  END Newcar;
16  END packageTest;
17  /
Package body created.
SQL> execute packageTest.Newcar('Ferrari', 007)
PL/SQL procedure successfully completed.
SQL> select * from cars;
CARNAME                                                CARREG
Ferrari                                                     7
SQL>

Similar Messages

  • 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.

  • What's wrong with executing procedure in package???

    I am new to SQL Developer. I had developed a PL/SQL package<br>
    (called COMMON_SQL) and compiled<br>
    in my database. I could see my package in USER_OBJECTS<br><p>
    COMMON_SQL          13966          PACKAGE     03-APR-07     03-APR-07     2007-04-03:22:46:27     VALID     N     N     N<br>
    COMMON_SQL          13967          PACKAGE BODY     03-APR-07     03-APR-07     2007-04-03:22:48:21     VALID     N     N     N<br><p>
    I did not find any compilation error on the package in USER_ERRORS,<br>
    i.e. the package was compiled and deployed successfully in my database.<br><p>
    But when ran the procedure CHECK_AND_DROP_OBJ in the package
    as follows:<br>
    declare flag integer := 1;<br>
    execute COMMON_SQL.CHECK_AND_DROP_OBJ('EXCEPTIONS','TABLE',flag);<br>
    /<br><p>
    It gave me the following error message:<br>
    Error report:<br>
    ORA-06550: line 2, column 65:<br>
    PLS-00103: Encountered the symbol "end-of-file" when <br>expecting one of the following:<br>
    begin function package pragma procedure subtype type use<br>
    <an identifier> <a double-quoted delimited-identifier> form<br>
    current cursor<br>
    06550. 00000 - "line %s, column %s:\n%s"<br>
    *Cause:    Usually a PL/SQL compilation error.<br>
    *Action:<br><p>
    where line 2, column 65 pointed to the last semicolon on the second line.<br><p>
    So why did it produce such an error?<br>
    Can anyone tell me what the problem was?<br>
    Do I need to configure or initialize SQL Developer?<br><p>
    Thanks for your help in advance,<br><p>
    AK<br><p>
    P.S. Here is the body of my package COMMON_SQL:<br>
    create or replace package body COMMON_SQL<br>
    as<br>
    <code> -- This procedure check for the existence of any database object by type.<br>
    -- It drops the object if it exists.<br>
    -- obj is the name of the dtabase object<br>
    -- type is the type of the object: table, index, sequence, synonym<br>
    -- flag has different types of values. <br>
    -- For in, flag = 1 for print debug message.<br>
    -- For out, flag = 0 for object not found.<br>
    -- flag = 1 for object found and dropped.<br>
    -- flag = -1 for error.<br>
    procedure CHECK_AND_DROP_OBJ (obj in varchar2, type in varchar2, flag in out integer)<br>
    is<br>
    obj_type USER_CATALOG.TABLE_TYPE%type;<br>
    str varchar2(100);<br>
    cursor obj_cur is<br>
    select TABLE_TYPE from USER_CATALOG where TABLE_NAME = obj;<br>
    begin<br>
    open obj_cur;<br>
    fetch obj_cur into obj_type;<br>
    if obj_cur%NOTFOUND<br>
    then<br>
    str := 'obj ' || obj || ' is not found';<br>
    if flag = 1<br>
    then<br>
    DBMS_OUTPUT.PUT_LINE(str);<br>
    end if;<br>
    flag := 0; -- return 0<br>
    elsif obj_type = type<br>
    then<br>
    str := 'drop ' || obj_type || ' ' || obj;<br>
    execute immediate(str);<br>
    if flag = 1<br>
    then<br>
    DBMS_OUTPUT.PUT_LINE(str);<br>
    end if;<br>
    flag := 1; -- return 1<br>
    else<br>
    str := 'obj ' || obj || ' has type mismatch';<br>
    if flag = 1<br>
    then<br>
    DBMS_OUTPUT.PUT_LINE(str);<br>
    end if;<br>
    flag := -1; -- return -1<br>
    end if;<br>
    close obj_cur;<br>
    --exception<br>
    null;  ??<br>
    END; --CHECK_AND_DROP_OBJ <br>
    END;<br>
    </code>
    Message was edited by:
    user567947
    Message was edited by:
    user567947
    Message was edited by:
    user567947
    Message was edited by:
    user567947
    Message was edited by:
    user567947

    smitjb,<br><p>
    I modified the package slightly and redeployed the package successfully.<br>
    Then I ran the stored procedure as you suggested:<br>
    declare debugf integer:=1;<br>
    rc integer:=0;<br>
    begin<br> SYSTEM.COMMON_SQL.CREATE_AND_DROP_OBJ('MPGCV_USER_SEQ','SEQUENCE',debugf,rc);<br>
    end;<br>
    /<br><p>
    But I still got, sort of, similar error:<br>
    Error starting at line 1 in command:<br>
    declare debugf integer:=1;<br>
    rc integer:=0;<br>
    begin<br>
    SYSTEM.COMMON_SQL.CREATE_AND_DROP_OBJ('MPGCV_USER_SEQ','SEQUENCE',debugf,rc);<br>
    end;<br>
    Error report:<br>
    ORA-06550: line 4, column 23:<br>
    PLS-00302: component 'CREATE_AND_DROP_OBJ' must be declared<br>
    ORA-06550: line 4, column 5:<br>
    PL/SQL: Statement ignored<br>
    06550. 00000 - "line %s, column %s:\n%s"<br>
    *Cause:    Usually a PL/SQL compilation error.<br>
    *Action:<br><p>
    I checked USER_ERRORS (found no error), and USER_OBJECTS and found both the package spec and body<br>
    So why did it not recognize the package and its stored procedure?<br>
    I was using SYSTEM account and should have the correct schema and privilege.<br>
    Any idea?<br><p>
    Thanks,<br><p>
    AK<br><p>
    P.S. Here is the body of my package:<br>
    <code>
    -- This package body contains all the functions/procedures<br>
    -- needed by any PL/SQL scripts<br>
    create or replace package body SYSTEM.COMMON_SQL<br>
    as<br>
    -- This procedure check for the existence of any database object by type.<br>
    -- It drops the object if it exists.<br>
    -- obj is the name of the dtabase object<br>
    -- otype is the type of the object: table, index, sequence, synonym<br>
    -- debugf indicates to print debugging message or not. <br>
    -- rc is the return code, <br>
    -- rc = 0 for object not found.<br>
    -- rc = 1 for object found and dropped.<br>
    -- rc = -1 for error.<br>
    procedure CHECK_AND_DROP_OBJ (obj in varchar2, otype in varchar2, debugf in integer, rc out integer)<br>
    is<br>
    obj_type USER_CATALOG.TABLE_TYPE%type;<br>
    str varchar2(100);<br>
    cursor obj_cur is<br>
    select TABLE_TYPE from USER_CATALOG where TABLE_NAME = obj;<br>
    begin<br>
    open obj_cur;<br>
    fetch obj_cur into obj_type;<br>
    if obj_type = otype<br>
    then<br>
    str := 'drop ' || obj_type || ' ' || obj;<br>
    execute immediate(str);<br>
    if debugf = 1<br>
    then<br>
    DBMS_OUTPUT.PUT_LINE(str);<br>
    end if;<br>
    rc := 1; -- return 1<br>
    else<br>
    str := 'obj ' || obj || ' has type mismatch';<br>
    if debugf = 1<br>
    then<br>
    DBMS_OUTPUT.PUT_LINE(str);<br>
    end if;<br>
    rc := -1; -- return -1<br>
    end if;<br>
    close obj_cur;<br>
    exception<br>
    when NO_DATA_FOUND<br>
    then<br>
    str := 'obj ' || obj || ' is not found';<br>
    if debugf = 1<br>
    then<br>
    DBMS_OUTPUT.PUT_LINE(str);<br>
    end if;<br>
    rc := 0; -- return 0<br>
    when OTHERS<br>
    then<br>
    str := 'error encountered SQLCODE:' || to_char(SQLCODE) || <br>
    ' SQLERRM:' || SQLERRM;<br>
    if debugf = 1<br>
    then<br>
    DBMS_OUTPUT.PUT_LINE(str);<br>
    end if;<br>
    rc := -1; -- return -1<br>
    END; --CHECK_AND_DROP_OBJ <br>
    END;<br>
    /<br>
    </code>

  • 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.

  • 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;

  • Execute procedure in a package using the caller privileges?

    Is it possible to execute a procedure within a package using the privileges of the caller rather than the privileges of the package owner? So if we have a procedure that does a select, one that does an insert, and another for update and a 4th for delete, then we just want to grant execute to user X on the select procedure in the package. This is a developer request. I think I just need to tell the requestor to copy or move the procedure out of the package and into it's own procedure so that it's safe to run by user X and not grant execute on the package since I don't believe it is possible to specify what procedures in a package are granted execute since that command is a blanket for the whole package right?
    Example - fails due to specifying the proc:
    grant execute on scmemaname.pkgname.procname to usr;
    There's no other command to do that is there?
    Thanks,
    Dave
    Edited by: Gib on Jan 19, 2010 8:42 AM

    AUTHID is at the package level ... not the individual function or procedure.
    Create a second package.

  • GRANT EXECUTE ON SCHEMA.PACKAGE.PROCEDURE TO USER

    Hi,
    GRANT EXECUTE ON SCHEMA.PACKAGE.PROCEDURE TO USER
    returns:
    ORA-00905, do you know why? Can I grant privileges on procedure inside package?
    thanks

    As per my knowledge of oracle, we cannot grant privileges on procedure inside a package.
    <br><br>
    Raj<br>
    <b>www.oraclebrains.com<a>
    <br><font color="#FF0000">POWERED by the people, to the people and for the people WHERE ORACLE IS PASSION.</font></b>
    <br>
    Sorry Leonardo Horikian & Kamal Kishore, I was late and didn't know that you guys have already posted the answer.
    Message was edited by:
    rajs

  • Execute procedure problem

    Hi,
    I have this problem.
    I have one procedure on first database (9.2.0.7) which is calling second procedure from it's body on second database (8.1.6.3.0) using dblink.
    When I connect from my client node (10.2.0.4 Oracle client) on first database everything is OK, I execute procedure and I get some results, because I have four output values from procedure.
    Problem is when I have tried to execute procedure from first database using it's client 9.2.0.7, I just don't get any output from it, but also I don't get any error.
    It's look like that there is some communication problem between 9.2.0.7 and 8.1.6.
    Example>
    1) Good output:
    execute vpku.pom_bscs_potr('190900641213696', '6275,07');
    b_r 19-090-064-1213696
    i_f 6275,07
    out1 6275,07
    out2 01/02/2009
    out3 N
    out4 1.1296014
    PL/SQL procedure successfully completed.
    2) Problematic output
    execute vpku.pom_bscs_potr('190900641213696', '6275,07');
    b_r
    i_f
    out1
    out2
    out3
    out4
    PL/SQL procedure successfully completed.
    Any idea,
    Thanks.

    Hi,
    What is the second parameter? Is this a number field? If so I think the problem will be setting of your environment, NLS_NUMERIC_CHARACTERS or THE NLS_LANGUAGE. This will define the decimal seperator, which I think is different on the two clients.
    First thing to do, drop the above mentioned solution of an exception handling. This will hopefully yield the real error. Possibly ORA-01722, Invalid number.
    Herald ten Dam
    Superconsult.nl

  • The problem (procedure, function, package) in  object browser

    we are using htmldb 2.0 in oracle DB 9.2.0.6. When we are using http server from 9.2 in the object browser for procedures, functions, packages display window show only header and all window is red, all other objects look fine. when the same DB I config with http server 10g(companion cd) it is display all objects fine.
    PS we didn't forget to put
    AddType text/xml xbl
    AddType text/x-component htc
    Is it bug in htmldb through http server 9.0.3.
    MB

    I thought this was a browser issue. I "see red" from IE from my home PC, but I thought that's because my browser isn't up to date. Update downloads are too big for the dialup connection from home.
    My IE and FF browsers work fine from work - where I update them regularly - over a nice fast connection.
    Earl

  • 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>

  • Error in Executing Procedure through DBLink

    Hi,
    I am facing some problems in executing a procedure through DBLink.
    I have two schema A and B in two different database.
    In schema A I am having one procedure X in package Y and my requirement is that I want to execute this procedure in schema B. So in schema B i have created one DBLink ABC and trying to execute procedure X using this DB link.
    begin
    A.Y.X@ABC;
    end;
    But I am getting below error:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'A.Y.X@ABC' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    Any help would be greatly appreciated!
    Thanks In Advance..
    Regards,
    Sachin Bansal

    Hi,
    Yes, I am connecting to user A of DB1 and in this user I am having procedure X in Package Y. My DBLink in Schema B of DB2 is pointing to user A of DB1.
    I have created DBLINK using below script:
    create public database link abc
    connect to A
    identified by A
    using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX)(PORT=1521)))(CONNECT_DATA=(service_name=XXX)))';
    Above DBLInk is working fine..I am able to access all the table of schema A in schema B using this DBLink. But when I trying to execute any procedre of schema A in schema B then i am getting error.
    Regards,
    Sachin

  • How can I compile all functions, procedures and packages with a script?

    I need to compile all functions, procedures and packages of 5 schemas (users) with a script.
    How can I do it?
    Thanks!

    you can create a script to select all invalid objects in those schemas Since Oracle 8 introduced NDS this approach has struck me as a trifle old fashioned. It's much simpler to loop round the query in PL/SQL and use EXECUTE IMMEDIATE to fire off the DDL statements. No scripts, no muss, no fuss.
    Having said that, the problem with this approach and also with using DBMS_UTILITY.COMPILE_SCHEMA is that they do not compile all the invalid objects in dependency order. This may result in programs being invalidated by the subsequent compilation of dependencies. This is due to the introduction of Java into the database.
    The UTLRP script is much better, because it (usually) avoids cyclic references. But you still may need to run it more than once.
    In general it is better to avoid sledgehammer recompilations (like DBMS_UTILITY.COMPILE_SCHEMA, which starts by invalidating all the objects). If we have twenty invalid objects, nineteen of which are dependencies of the twentieth, we actually only need to recompile the master object, as recompiling it will trigger the recompilation of all the others.
    Cheers, APC

  • Trying to Execute Catalog SSIS Package using Catalog stored proc by a Master SSIS package inside a Loop

    Hi Guys ,
    To Execute Packages deployed in Catalog , I have created a wrapper SP  which internally calls  catalog SP  ( below is the code )
    ALTER PROCEDURE [Publish].[usp_ExecutePackages]
                  @PackageName NVARCHAR(255) 
           ,      @ProjectFolder    NVARCHAR(255) 
           ,      @ProjectName NVARCHAR(255) 
    AS    
    BEGIN
    SET NOCOUNT ON;
    DECLARE @Execution_id BIGINT ;
    EXEC [SSISDB].[catalog].[create_execution] @package_name
    = @PackageName
    ,   @execution_id
    = @Execution_id OUTPUT
    ,   @folder_name
    = @ProjectFolder
    ,   @project_name
    = @ProjectName
    ,   @use32bitruntime=
    True;
    EXEC [SSISDB].[catalog].[set_execution_parameter_value] 
    @execution_id,  
    @object_type=50, 
    @parameter_name=N'SYNCHRONIZED', 
    @parameter_value=1
    EXEC [SSISDB].[catalog].[start_execution]            @Execution_id
    Since i have multiple Packages , I am looping through list of PackageName and trying to pass package names to this SP by ExecureSQLTask inside ForLoop Container . But it errors out saying 
     "Cannot access the package or the package does not exist. Verify that the package exists and that the user has permissions to it.
    BUt same Execute SQL task , if i keep it outside the ForLoop Container it works perfectly fine . 
    I am  clueless , Please Please HELP me ASAP :( 
    Question :
    How is that possible to execute same SP with same parameter outside Container , But not in SEQUENCE or FORLOOP or FOREACH Container ?
    Also 
    How to make a master package to execute SSIS deployed packages via TSQL using catalog stored proc ?
    Please help me out .
    Thanks 
    Prasanna Selvaraju

    Hi , 
    After debugging i am getting parameter values as  
    {Extract - ARTL.dtsx\r\n} Unable to evaluate the expression.
    Why do i get  \r\n which i dont want in parameters .
    Actually i pick the values of package name from a custom table . I check it there are no spaces in the cell.
    Any IDEA WHY ? Please help
    Finally it worked to call Wrapper Class for EXEC [SSISDB].[catalog].[create_execution]
    stored procedure .
    Basically , ERROR MESSAGE is culprit
     "Cannot access the package or the package does
    not exist. Verify that the package exists and that the user has permissions to it. 
    Above Message : causing us to think
    its an Access issue , But actually when you pass parameter incorrectly even a " " space or "\n" extra to value, you will get that error .
    Nothing related to access problem .
    Actually , In the parameter which i was passing :
    {Extract - ARTL.dtsx\r\n} --> String with Enter / Carriage Return and Break line was there 
    I have removed the Enter in that variable value .
    Now its WORKING FINE ! Hurry :D :) 

  • Import PLSQL procedure or package into OWB

    Here's a simple question. In schema X, I created a procedure and a package. If I try to import them into OWB (10g R2), connecting to schema X and clicking on transformations and "import" doesn't show the newly created objects for import. I tried granting execute to OWB10GR2, but no luck. Closed and re-started design center with no luck.
    Creating a procedure in Design Center and then deploying it to schema X works and is a workaround, but it's awkward to write code there (compile is deploy, which takes a lot longer than normal compile).
    What am I missing so that I can't import a procedure into design center?

    OK, so I'm going to answer my own question. Maybe someone else can use the info...
    The problem is that I have development and production configurations.
    Procedure or package defined only in one (dev or prod) schema won't show up on the import list. Apparently, in order to import the object into OWB you need to define it in all environments. Otherwise it doesn't show up on the import list.

  • How to execute procedure in toad software

    hiii guy's i run my procedure on sql prompt and it run properly
    but when i tried this on toad i got an problem
    after compiling my procedure on toad
    when i write
    execute procedure_name(parameter1,parameter2);
    then i get an error i.e
    ORA-00900: invalid SQL statement
    can someone tell me how to execute procedure on toad
    thanks in adv...........

    how to execute procedure in toad softwareIn TOAD's schema browser you can go to the procedures tab - right click on the procedure in question and choose execute procedure - a window should pop up, where you can give optional parameters - the rest should be almost self explanatory ;)

Maybe you are looking for

  • Auto Fill Shipping Address from Billing Address on a New Form in SharePoint 2013

    I have a new form on SharePoint that has a few fields: Billing Address 1 (Single Line of Text) Billing Address 2 (Single Line of Text) Billing Address City (Single Line of Text) Billing Address State (Drop Down Menu) Billing Address Zip (Single Line

  • At every start of the computer I have to connect to Adobe CC

    Hello, everytime i start the computer (iMac on Mavericks, newest updates), the cc software prompts that i am not connected. I have to type in my e-mail-adress and the passport and to accept the license – for each app! How can I solve this problem.

  • Importing photos in a new folder on Elements 10

    When I import photos straight from my SD card tp Elements 10 I have been naming a new folder for them but they are going into sub folders of the last file that I had open. How do I stop this & how do I make move the sub folders into a new folder of i

  • Error in ESSO ladap sync extension failure

    I am using ESSO admin console and login manager.admin console is working fine in LADP as well as logon manager. But when i put user id and password in logon manager it is showing errors ldap sync failure. Any body help me.

  • Domain User Issue with email

    When a new user account is created mail will not work on devices or outlook clients (discovery doesn't work either) until the account has been logged into the domain at least once.  Has anyone experienced this or found a fix? Thanks!