Wrong execution of a package within a procedure stored

Oracle version: 10.2.0.4 RAC

I posted the below problem in REPLICATION forum but I think he needs to be here. I think I'm having a problem with some "shade" of Oracle, which relates to the appellant a package in a regulation and immunities.

Here is the original post:
================================================================================================

Get an ora-12048 and ora - 942 when executing dbms_refresh.refresh in a stored procedure. When I invoke dbms_refresh.refresh directly from SQLPlus things work very well.

Here is the header and the relevant code in the stored procedure:

create or replace PROCEDURE p_mv_refresh (p_refgrp IN VARCHAR2) AS

v_refgrp all_refresh_children.rname%TYPE;

BEGIN
v_refgrp: = UPPER (p_refgrp);
DBMS_REFRESH. Refresh (v_refgrp);
end;

Here is the definition of the refresh Group:

exec dbms_refresh.make (name = > 'BENEFITS_REFGRP',-)
list = > 'MV_INDIVIDUAL_CUR, MV_CCR_CUR, MV_BUSINESS_DBA_CUR, -.
next_date = > sysdate;
interval = > NULL,--
implicit_destroy = > FALSE;
Lax = > FALSE;
rollback_seg = > NULL,--
push_deferred_rpc = > FALSE;
refresh_after_errors = > FALSE;
purge_option = > NULL,--
parallelism = > 8, -.
heap_size = > NULL);

I run in SQLPLUS by passing the name of the refresh Group in the stored procedure:

SQL > exec p_mv_refresh ('BENEFITS_REFGRP');

And I get this:

Error: ORA-12048: error in materialized view Refresh
'UIMVIEWS '. "" MV_BUSINESS_DBA_CUR ".
ORA-00942: table or view does not exist

When I have exec dbms_refresh.refresh('BENEFITS_REFGRP') directly in SQLPlus, everything runs without failure.

Here is the definition of MV:

CREATE THE MV_BUSINESS_DBA_CUR MATERIALIZED VIEW
ON PREBUILT TABLE
COMPLETE REFRESH
DISABLE THE QUERY REWRITE AS
(SELECT *)
OF xxxxxxxx...) ;

There is no newspaper of MV on the source (no fast refresh) table.

Table source and MV are same DB, different schemas.

Just to be safe in tests, I attributed select privileges on the source table to the MV schema via a role and directly. Does not solve.

New - the MV refreshes thin when done directly from a SQLPlus prompt. It fails only when I run it from within the stored proc.

Thanks in advance for your suggestions...

TonyG

Here are additional info I posted:
=========================================================================
Here is an update - I tried the same procedure only this time replaced the call to dbms_refersh with a call to dbms_mview, just to see if he would run.

This isn't. I am quite sure, I hit a kind of question of privilege that has to do with a package requiring a package, but I don't know enough with what it might be. dbms_mview works fine from the command line, just like the fact dbms_refresh.

Here's what happened when I called the proc dbms_mview

Error: ORA-12008: error in the path of refresh materialized view
ORA-00942: table or
view does not exist
=========================================================================

Thanks in advance for any help.

A stored procedure does not inherit from grants of role, you must make grants directly to the relevant tables/views/mast views and can not give these permissions to the roles of througth.

Date of arrival:
http://download.Oracle.com/docs/CD/B10500_01/server.920/a96524/c24privs.htm#4770--> blocks named with copyright

Published by: Pedro_gloria on 10-Dec-2010 07:54

Tags: Database

Similar Questions

  • procedure of package within a single package

    can we call a package within a package procedure.

    I have a package which has 2 procedure P1 and P2 and works. F1

    F1 needs to use both P1 and P2.

    Can I call P1 and P2 within F1. Do need to be called as pgkname. Even if they are inside the package P1?

    Thank you

    Yes, you can:

    SQL> create or replace package my_pkg
      2  as
      3    function f1 return number;
      4  end;
      5  /
    
    Package created.
    
    SQL> create or replace package body my_pkg
      2  as
      3    procedure p1
      4    is
      5    begin
      6      dbms_output.put_line('Hi, I''m P1');
      7    end;
      8    procedure p2
      9    is
     10    begin
     11      dbms_output.put_line('Hi, I''m P2');
     12    end;
     13    function f1 return number
     14    is
     15    begin
     16      p1;
     17      p2;
     18      return 1;
     19    end;
     20  end;
     21  /
    
    Package body created.
    
    SQL> select my_pkg.f1 from dual;
    
            F1
    ----------
             1
    
    1 row selected.
    
    Hi, I'm P1
    Hi, I'm P2
    

    Look and find in:
    This forum
    http://www.Oracle.com/pls/db102/homepage
    http://www.Oracle.com/pls/db112/homepage
    http://asktom.Oracle.com

  • migration package to the procedure, how to use THE params

    Hi all
    We just roll back packages in the stand alone procedures and I starat have problems with syntax and OUT defintion, for example our body of package/East:
    create or replace
    PACKAGE          PACK_RYBA_INVENT AS 
      TYPE CURSOR_INFO IS REF CURSOR;
      -- FUNCTION DECLARATIONS
      PROCEDURE p_RYBA_GetALL (in_custom IN NUMBER, out_cursorINFO OUT CURSOR_INFO);
    END PACK_RYBA_INVENT;
    
    -- body
    create or replace
    PACKAGE BODY                   PACK_RYBA_INVENT AS
      PROCEDURE p_RYBA_GetALL (in_custom IN NUMBER, out_cursorINFO OUT CURSOR_INFO) AS
        BEGIN
          OPEN out_cursorINFO FOR
          SELECT id_comp, id_name, cust_profile   FROM tc_INFO
          WHERE id_comp = in_custom;
        END p_RYBA_GetALL;
    END PACK_RYBA_INVENT;
    It is sweet to cursor declataion, specify us its type in code 'run '.
    I'm still new to Oracle, and I have the problem with the compilation of my inside, do not know how to correctly, report Cursro or should I let its declation in Packge and referencing it from there? How better to give this slider out all statements within the procedure, what Miss me? and I want to use the 'Cursor OPEN FOR' approach if possible.
    create or replace  Procedure  p_RYBA_GetALL (in_custom IN NUMBER,  out_cursorINFO OUT CURSOR_INFO) AS
     TYPE CT IS REF CURSOR RETURN tc_INFO.id_comp%TYPE, tc_INFO.id_name%TYPE , tc_INFO.cust_profile%TYPE;
     CURSOR_INFO CT;
       BEGIN
          OPEN out_cursorINFO FOR
          SELECT id_comp, id_name, cust_profile   FROM tc_INFO
          WHERE id_comp = in_custom;
        END ;
    TX
    TR

    Published by: trento on September 21, 2010 14:25

    sys_refcursor is available on 9i, here is the sample code that I tried...

    create or replace procedure getAllHierarchies (oc_sysrc out sys_refcursor)
    IS
    BEGIN
     OPEN oc_sysrc FOR SELECT * FROM tstproduct;
    EXCEPTION WHEN OTHERS THEN
       RAISE_APPLICATION_ERROR(-20002,SQLERRM);
    END getAllHierarchies;
    

    Then the procedure is called in this way...

    DECLARE
      refCursorValue SYS_REFCURSOR;
      myRecord tstproduct%ROWTYPE;
    BEGIN
      getAllHierarchies(refCursorValue);
    
      LOOP
        FETCH refCursorValue INTO myRecord;
        EXIT WHEN refCursorValue%NOTFOUND;
        dbms_output.put_line(TO_CHAR(myRecord.product_id)||' '||myRecord.product_description);
      END LOOP;
    EXCEPTION WHEN OTHERS THEN
      dbms_output.put_line(TO_CHAR(SQLCODE)||' '||SQLERRM);
    END;
    
  • Why we need to create the package instead of procedure or function in Oracle

    Hello

    Recently, I attended an interview, they asked,
    why we must create the package instead of procedure or function in oracle. Is a specific advantage, if we create together.
    I'm not sure. can u tell me please someone.

    Thank you and best regards,
    Sanjeev.

    Hello

    A part of the oracle documentation.

    What is a PL/SQL Package?
    A package is a schema object which includes subroutines, variables, and logically related PL/SQL types. Packages have two parts: a specification (spec) and a body. Sometimes, the body is unnecessary. The specification is the interface to the package. It declares the types, variables, constants, exceptions, cursors, and subprograms that can be referenced from outside the package. The body defines queries for the sliders and the code for the subprogrammes.

    Benefits of the PL/SQL Packages
    Packages have a long history in software engineering, offering important characteristics for a reliable, maintainable, and reusable code, often in team for large systems development efforts.

    Modularity

    Packages allow you to logically encapsulate Associates types, elements, and subroutines in a module named PL/SQL. Each package is easy to understand, and the interfaces between packages are simple, clear and well defined. This facilitates the development of applications.

    Easier application design

    When you design an application, all you need initially is the interface information in the package specification. You can code and compile a spec without his body. Stored subprograms that reference the package can then be compiled as well. You should not set the package body entirely until you are ready to complete the application.

    Information masking

    With packages, you can specify which types, elements, and subprogrammes are (and accessible) public or private (hidden and inaccessible). For example, if a package contains four subprogrammes, three can be public and one private. The package hides the implementation of the subprogramme private so that only the package (not your application) is affected if the application changes. This simplifies maintenance and improvement. Also, by hiding the implementation details of the users, you protect the integrity of the packaging.

    Feature added

    Sliders and packed public variables persist for the lifetime of a session. They can be shared by all the subprogrammes that are running in the environment. They allow you to manage data in any of the transactions without storing in the database.

    Best performance

    When you call a subprogram packaged for the first time, the whole package is loaded into memory. Subsequent calls to related subprograms in package require no disk i/o.

    Packets stop cascading dependencies and avoid an unnecessary recompilation. For example, if you change the body of a packaged function, Oracle does not recompile other routines that call the function; These routines only depend on parameters and return value that are declared in the specification, so they are recompiled only if the specification changes.

  • extract the package and the procedure name in the code

    In my treatment of exceptions, I need to register the name of package and procedure I have the exception. How can I get these two names without manually coding the names?

    Thanks to anticipiation

    A better option is to get the package name and the line number

    An even better option is to use the pl/scope (when you are in 11g (not sure about 10g)):

    SQL> alter session set plscope_settings='identifiers:all'
    /
    Session altered.
    
    SQL> set serverout on
    
    SQL> create or replace package pkg
    as
       procedure p1;
    
       procedure p2;
    end pkg;
    /
    Package created.
    
    SQL> create or replace package body pkg
    as
       procedure get_scope (obj varchar2, line int)
       as
       begin
          for c in (select rpad (lpad (' ', 2 * (level - 1)) || name, 20, '.') || ' ' || rpad (type, 20) || rpad (usage, 20) identifier_usage_contexts
                    from user_identifiers t
                    where level != 1
                    start with line = get_scope.line and object_name = obj
                    connect by usage_id = prior usage_context_id)
          loop
             dbms_output.put_line (c.identifier_usage_contexts);
          end loop;
       end get_scope;
    
       procedure p1
       as
       begin
          null;
       end p1;
    
       procedure p2
       as
       begin
          get_scope ($$plsql_unit, $$plsql_line);
       end p2;
    end pkg;
    /
    Package body created.
    
    SQL> exec pkg.p2
    
      P2................ PROCEDURE           DEFINITION
        PKG............. PACKAGE             DEFINITION
        PKG............. PACKAGE             DECLARATION
    PL/SQL procedure successfully completed.
    
  • Overloading a package with private procedures

    Hi all

    Is there a probelem if you overload a package with private procedures?
    In other words if I have two methods named as in a package, of which none is declared in the pacakge specification? It seems that I always overloaded a package with public procedures.

    Thanks for any help,
    Bradley

    I can:

    SQL>CREATE OR REPLACE PACKAGE test
      2  AS
      3    PROCEDURE test_public;
      4  END  test;
      5  /
    
    Package created.
    
    Elapsed: 00:00:00.00
    SQL>
    SQL>sho err
    No errors.
    SQL>CREATE OR REPLACE PACKAGE BODY test
      2  AS
      3    PROCEDURE test_private (num IN NUMBER)
      4    IS
      5    BEGIN
      6      DBMS_OUTPUT.PUT_LINE('number: '||TO_CHAR(num));
      7    END test_private;
      8
      9    PROCEDURE test_private (str IN VARCHAR2)
     10    IS
     11    BEGIN
     12      DBMS_OUTPUT.PUT_LINE('string: '||str);
     13    END test_private;
     14
     15    PROCEDURE test_public
     16    IS
     17    BEGIN
     18      NULL;
     19      test_private(1);
     20      test_private('a');
     21    END test_public;
     22  END  test;
     23  /
    
    Package body created.
    
    Elapsed: 00:00:00.01
    SQL>sho err
    No errors.
    SQL>
    SQL>exec test.test_public
    number: 1
    string: a
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.00
    SQL>
    SQL>select * from v$version;
    
    BANNER
    ________________________________________________________________
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for Linux IA64: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    
    Elapsed: 00:00:00.04
    SQL>
    
  • Call procedures stored in adf

    Hi all

    is it possible to call procedures stored in the adf.

    Thank you

    Hello

    It's my first chance to "pay it forward". Please visit this link (which helped me): Blog of Zeeshan Baig: the PL/SQL procedure call and function in the Oracle ADF application

    James

  • I just upgraded from CS 6 (Dreamweaver) and now when I click on an image on a web page in Dreamweaver is wrong in the folder where the photo is stored and more.  If this continues, I'll have to go back to 6 CS that I put in a lot of photos.

    I just upgraded from CS 6 (Dreamweaver) and now when I click on an image on a web page in Dreamweaver is wrong in the folder where the photo is stored and more.  If this continues, I'll have to go back to 6 CS that I put in a lot of photos.

    I use dw cc and I just double-click on the photo I want to change in dreamweaver CC and my images folder opens, select new photo and then it updates and I'm good to go, I use a mac

  • Call a package within a stored procedure

    Hi people,

    I created a package that works very well (well compiled).

    Now, if I run my package via a command in the oracle command line:

    run package_name.procedure_of_package ("arguments");

    in this way, it works perfectly.

    Inside of another procedure (procedure2) I do the same thing,

    but it gives the error:
    There is no function with the name of procedure_of_package in this scope.

    I implemented on the owner of shema and I'm also running on the owner of the schema.

    Thank you very much

    Pipoca

    Hello

    What do you do?...

    If you want to call the "procedure1' according to the number of records in the table 'table_a', then you can do:

    CREATE OR REPLACE PROCEDURE procedure2 AS
       v_teste  number;
    BEGIN
       SELECT count(*)
       INTO   v_teste
       FROM   table_a;
    
       IF v_teste = 0 THEN
          package1.procedure1('AAA', 'BBB');
       ELSE
          package1.procedure1('111', '222');
       END IF;
    END;
    
  • Multiple sub-programs within a procedure call

    I'm trying to program it in pl/sql for the program that is already written in cobol. The program in cobol has several programs, but they use or access multiple variables used in other programs. As create of these subprograms in separate proceedings (with a pass), it will take several variables back, I built subprocedured in a procedure so that they can share these common variables. Problem arises when these Subprocedures call new procedure that are common to the other Subprocedures.
    Example of

    Create or replace procedure that x is

    -Sub procedure
    procedure as A1
    Start
    --
    b;-will call the sub sub procedure, which shares many variables
    --
    end;

    procedure as a2
    Start
    --
    b; -call Sub procedure sub who shares many variables
    --
    end;

    procedure b as
    Start
    null;
    end;


    Start
    A1; -subprocedure that shares many variables
    A2; -subprocedure that shares many variables

    end;
    Question is how to write sub sub procedure b? Compilation top says this sub b procedure should be defined as part of a1 and a2 procedures that I will be duplication b. procedure (because there are many variables in the procedure b uses whats in other proceedings, I don't want to create a separate procedure within the package passing - variable input and output variables). Can someone please suggest a solution for this? Appreciate the answer on that.

    Published by: vamadeva July 27, 2010 12:08

    Published by: vamadeva July 27, 2010 12:10

    It is the forward declaration. You must program Sub B before you make calls in the procedure of A1 and A2.

    Create or replace procedure X is
    
    ---subprogram b---
    procedure b as
    begin
    null;
    end;
    
    --subprocedure
    procedure a1 as
    begin
    --
    b;--will call sub sub procedure which shares many variables
    --
    end;
    
    procedure a2 as
    begin
    --
    b; --will call sub sub procedure which shares many variables
    --
    end;
    
    begin
    a1; -- subprocedure which shares many variables
    a2; --subprocedure which shares many variables
    
    end;
    

    Try this out, surely it would work.

  • Reg: DDL within a procedure.

    Dear Experts,

    Can we have a DDL inside a procedure/package. Here is the sample code for reuse by the members of the team if any change should be done.

    Could you please clarify for me / guide me, it is the right approach or would there be effects or is - this cool by oracle or not.

    CREATE OR REPLACE

    PROCEDURE ALTPRC)

    TNOM IN VARCHAR2,

    NAME OF COLUMN IN VARCHAR2,

    DTYPE IN VARCHAR2)

    IS

    VSQL VARCHAR2 (100);

    BEGIN

    VSQL: = 'alter table ' | TNOM | 'Add'. COLNAME | » '|| DTYPE;

    DBMS_OUTPUT. Put_line ('Alter Stmt: ' |) VSQL);

    RUN IMMEDIATELY VSQL;

    END;

    ALTPRC EXEC ('emp1', 'testcol', 'number');

    Thank you

    Can do us, YES. Should do us, (there are always exceptions) most of the time no..

    Issue DDL COMMIT before and after the statement. So, it cannot be part of a transaction. A good DB design will not data structure allow to change on the FLY. A good application handles changes to dictionary in a version control system.

    So can you share with us what kind of benefits you are searching by an alter as statement

    ALTPRC EXEC ('emp1', 'testcol', 'number');

    to the course to do as

    ALTER TABLE EMP1 ADD COLUMN TESTCOL NUMBER;

    One of the reasons could connect. But I can't find satisfactory as a reason to do it this way.

  • How to create a package with the procedures?

    Referring by the net, I've written the following PCK file. I installed my Oracle database 11g in VirtualBox (Win XP). I can able to select tables using the query from the host (Windows 7)

    CREATE OR REPLACE PACKAGE APEX_SYS_PCK

    AS

    TYPE refcursortype IS REF cursor

    PROCEDURE GET_USER_DETAILS)

    D1 ON refcursortype,

    P_USER IN VARCHAR2,

    P_PASS IN VARCHAR2);

    END APEX_SYS_PCK;

    /

    CREATE OR REPLACE PACKAGE BODY APEX_SYS_PCK

    AS

    PROCEDURE GET_USER_DETAILS)

    D1 ON refcursortype,

    P_USER IN VARCHAR2,

    P_PASS IN VARCHAR2)

    IS BEGIN

    OPEN D1 FOR SELECT * FROM APEX. PEOPLE;

    END GET_USER_DETAILS;

    END APEX_SYS_PCK;

    /

    When I try to run the script, I get the following error. How to solve this problem? If there is an error in this package please correct!

    • Project: sqldev.temp:/IdeConnections%23vAPEX.jpr
    • F:\PACKAGES\APEX_SYS_PCK. SQL
    • Error: PL/SQL: analysis of completed Compilation unit
    • Error (1.14): PLS-00905: APEX oppose. APEX_SYS_PCK is not valid
    • Error (1.14): PLS-00304: impossible to compile 'APEX_SYS_PCK' body without its specification

    You are missing a semicolon after

    TYPE refcursortype IS REF cursor

    in the specifications of your package.

  • error in the execution of the package

    Hello
    New on odi.here I write my doubt @ IAM I 10 interfaces in a running package.while 5th interface does not happen, but I want to run from interface that has failed
    How can we please suggest me

    Of course you can do it. But don't forget to examine the State of execution of all your steps after each run.

  • How to get the name of the package to a procedure used in a workflow process activity

    Hi all. I'm on OWB 11.2.0.2.0.

    When I used a function or a procedure that is packed for a mapping operator, I can find the name of package.program_unit by getting FUNCTION_NAME property of the operator. For example,.
    OMBRETRIEVE MAPPING "$mapName" OPERATOR "$operName" GET PROPERTIES (FUNCTION_NAME)

    But when even is used in a workflow process activity, I can't find a property name that will give me the same information. I can get the BOUND_NAME, it don't tell me the name of the package. It must be stored in the properties of the activity because when you pull up to synchronize for the activity dialog box, he knows the name of package.

    Is it possible to get this via an OMBRETRIEVE?

    Thank you.

    Try this:
    OMBRETRIEVE PROCESS_FLOW 'PF_NAME' ACTIVITY 'PROCEDURE_NAME' GET REF
    It gives you the full path to the process/PROJECT/MODULE/PACKAGE. PROCEDURE
    Concerning
    ANA GH

  • Call objects (packages-Pl/SQL procedures) DB of the ADF

    Hello

    1. How can we call DB procedures/Packages using ADF?

    2 are there scenarios describing when to use what Layout? & Also any introduction of layouts in the ADF.

    Thank you.

    Hello

    You can expose your PL/SQL package in the form of web services as well and use it on your layout. Check this blog entry on the call of PL/SQL of the ADF, it may be useful
    http://baigsorcl.blogspot.com/2010/05/calling-PLSQL-procedure-and-function-in.html

    This presentation would help understand layouts http://blogs.oracle.com/shay/2010/05/adf_faces_layouts_demo_-ahid.html
    also, you can refer to the guide of the web user interface.

Maybe you are looking for

  • errors installing...

    i ' am having a problem that there are specific applications won't install I only get errors "this app can be installed at this time" so please I need a solution, I tried everything on the internet, but none of them worked for me... and another quest

  • Can't get titles and Internet sites in proportion. Too wide

    Suddenly, websites and titles of tabs is extended and out of proportion. It is not the zoom. Cannot understand it. Tried to restore but it did not help. Could someone please tell me what to do? Thank you

  • Password blackBerry Smartphones Media Card

    Can you please tell me how can I reset the password on the card. I have forgotten the password and can't access the photos

  • Snapshot.Policy.Disable does not work

    I would like to create a group of companies with vRealize Automation 6.2.2 that disable all user roles (includes the Manager of Group of professionals, administrator of fabric, the business group support and commercial users of the Group) to create s

  • Suppression of the rights of the mother of workflow

    Hi allIs it possible to remove permissions from the parent to be inherited from specific workflows or workflow folders?Delete it is greyed out, but there are some workflow that I want to remore the display of our administrator users web operator cons