View, instead of trigger and ORA-01031

Hello,
I have a view based on outer joins like
CREATE VIEW vt ( colV1, colV2, colV3, colV4, colV5, colV6, colV7, colV8 ) AS
SELECT A.colA1, A.colA2, C.colB0, B.colB2, B.colB3, B.colB4, C.colC2, H.colH2
  FROM  tabA    A
       ,tabB    B
       ,tabC    C
       ,( SELECT  ...
            FROM   tabD  D
                  ,tabE  E
            WHERE  D.colD1 = E.colE1
         )  H                                
  WHERE A.colA1 = B.colB1
    AND LTRIM(B.colB2,'A') = LTRIM(C.colC1(+),'A')    
    AND B.colB3 = H.colH1(+); and an instead of trigger
CREATE OR REPLACE TRIGGER vt_upd
  INSTEAD OF UPDATE ON vt
BEGIN
  UPDATE    tabB
     SET    colB4 = :NEW.colV6
     WHERE  colB0 = :NEW.colV2;
END;An now the problem: an update statement UPDATE vt set colV6=1 WHERE colV1=1; in SQL*Plus works as it should, but performing an update in APEX from a tabular or edit form shows an error: ORA-01031:ORA-01031: insufficient privileges, update...The strange thing: in both sessions there is the same user USER1 logged on !
Why this difference ? Can anybody explain ?
Regards,
Heinz

Hi Heinz,
Your statement -
what I wrote as table tabC in reality is a view to one table and one view in another schema.That'll be it, you need to grant explicit rights for the objects in that schema to the schema that is your parsing schema for your workspace.
In other words, if you have -
1) Workspace 'A' with parsing schema 'B'
and you are trying to do -
select foo from c.bar
i.e. you're trying to query an object in schema 'C'.
Then you need to (as a DBA or connected to schema C) -
grant select on bar to b;Roles won't work (when used through APEX)...I can't say that any other way, you might find it works in SQLPlus with roles, but through APEX it won't...you need those explicit grants.
Hope this makes sense.
John.

Similar Messages

  • Instead of trigger and merge

    Hi,
    I have created view and instead of insert, delete, update triggers on it. It is working fine for insert, delete, update. However, the application uses lots of merge command. For merge command on the view, I get following error
    ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
    I dont have any rowid mentioned in merge command. Is there way how to make MERGE working over view with instead of triggers ?
    Thanks for advices.

    my view is simple, it is "union all" operation over several tables without any other conditions, original tables are index organized with PK consisting of 4 columns
    EDIT:
    here is simplified example of the problem
    create table val_00 (
    id number(10),
    data varchar2(100),
    constraint pk_val_00 primary key (id) validate
    ) organization index;
    create table val_01 (
    id number(10),
    data varchar2(100),
    constraint pk_val_01 primary key (id) validate
    ) organization index;
    create or replace view val as
    select id, data from (
    select id, data from val_00
    union all
    select id, data from val_01
    create or replace trigger trg_val_ins
    instead of insert on val
    referencing new as new
    for each row
    begin
    case mod(:new.id, 2)
    when 0 then insert into val_00 (id, data) values (:new.id, :new.data);
    when 1 then insert into val_01 (id, data) values (:new.id, :new.data);
    end case;
    end;
    create or replace trigger trg_val_upd
    instead of update on val
    referencing old as old new as new
    for each row
    begin
    if updating('id') then
    raise_application_error(-20999, 'you can not update primary key in val');
    end if;
    case mod(:new.id, 2)
    when 0 then update val_00 set data = :new.data where id = :old.id;
    when 1 then update val_01 set data = :new.data where id = :old.id;
    end case;
    end;
    create or replace trigger trg_val_del
    instead of delete on val
    referencing old as old
    for each row
    begin
    case mod(:old.id, 2)
    when 0 then delete from val_00 where id = :old.id;
    when 1 then delete from val_01 where id = :old.id;
    end case;
    end;
    insert into val values (1, 'one');
    insert into val values (2, 'two');
    insert into val values (3, 'three');
    insert into val values (4, 'four');
    insert into val values (5, 'five');
    delete from val where id = 2;
    insert into val values (2, 'twooo');
    update val set data = 'two' where id = 2;
    commit;
    merge into val using
    ( select 10 as id, 'ten' as data from dual ) newdata
    on (val.id = newdata.id)
    when matched then
    update set val.data = newdata.data
    when not matched then
    insert (id, data) values (newdata.id, newdata.data);
    ERROR at line 1:
    ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
    Edited by: kamilp on Aug 18, 2012 8:17 AM

  • Instead Of Trigger And multiple Updable fields

    Hi all,
    I have an application based on a view (Customers,Products,..) above which an INSTEAD OF TRIGGER handles the updates done by end users.
    A field,Updated_Date stores the date when the tuple was last modified.To better capture information and enhance the updates processes,
    I want to store the exact date when a given field is modified.Only that field not the whole tuple.
    Solution
    Instead of 1 field,updated_date, i'd rather create 1 update_date_x for each column that might likely be modified.
    I.e: updated_date_phone,updated_date_fax,...
    Question
    Is it possible to combine all those fields within a single Trigger firing with respect to the field being altered ?
    Rather than creating a trigger for each updatable column.
    Thks for any advise/point to a useful doc.
    Lamine

    Check if the following helps.
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm#376
    From above link
    Detecting the DML Operation That Fired a Trigger (INSERTING, UPDATING, and DELETING Predicates)
    If more than one type of DML operation can fire a trigger (for example, ON INSERT OR DELETE OR UPDATE OF Emp_tab), the trigger body can use the conditional predicates INSERTING, DELETING, and UPDATING to check which type of statement fire the trigger.
    Within the code of the trigger body, you can execute blocks of code depending on the kind of DML operation fired the trigger:
    IF INSERTING THEN ... END IF;
    IF UPDATING THEN ... END IF;
    The first condition evaluates to TRUE only if the statement that fired the trigger is an INSERT statement; the second condition evaluates to TRUE only if the statement that fired the trigger is an UPDATE statement.
    In an UPDATE trigger, a column name can be specified with an UPDATING conditional predicate to determine if the named column is being updated. For example, assume a trigger is defined as the following:
    CREATE OR REPLACE TRIGGER ...
    ... UPDATE OF Sal, Comm ON Emp_tab ...
    BEGIN
    ... IF UPDATING ('SAL') THEN ... END IF;
    END;
    The code in the THEN clause runs only if the triggering UPDATE statement updates the SAL column. This way, the trigger can minimize its overhead when the column of interest is not being changed.

  • [11g] ORAPWD and ORA-01031

    Hello,
    I use Oracle 11g on Linux and I cannot remotely connect as SYSDBA in sqlplus.
    I created the password file with ORAPWD, I set parameter remote_login_passwordfile to EXCLUSIVE and I restarted the database.
    But I still get the error ORA-01031: insufficient privileges.
    When I check the v$pwfile_users view, it is empty:
    SQL>  SELECT FROM v$pwfile_users ORDER BY username;*
    no row
    If I connect with other user non-SYSDBA, it does work.
    What did I forget?

    Hi,
    Checklist to help you to solve your problem:
    1)Check if use belong to DBA group.
    2)Set ORACLE_SID, export ORACLE_SID=<Instance name>
    3) Check if remote_login_passwordfile parameter in your pfile or spfile is set to either EXCLUSIVE or SHARED .
    4) Create the password file in your $ORACLE_HOME/dbs
    Also take a look in the following Metalink Notes:
    - Troubleshooting ORA-1031 Insufficient Privilege -      Doc ID:      Note:730067.1
    - UNIX: Checklist for Resolving Connect AS SYSDBA Issues -      Doc ID:      Note:69642.1
    Cheers,
    Francisco Munoz Alvarez
    http://www.oraclenz.com

  • Export Failing with EXP-00008: ORACLE error 1031 encountered and ORA-01031:

    HI Folks,
    I am trying export the 11.2.0.2.0 database using export 'exp' utility.I am getting below errors while exporting with my 'sa' user. I am below role privileges for the 'sa' user. The export from the same kind of priivileged user in other Database is working.
    1* select * from dba_role_privs where grantee='SA' order by 2
    SQL> /
    GRANTEE GRANTED_ROLE ADM DEF
    SA ACCOUNT_CREATOR NO YES
    SA APPLICATION_CREATOR YES YES
    SA APPLICATION_DBA NO YES
    SA APPLICATION_DEVELOPER YES YES
    SA APPLICATION_USER NO YES
    SA AQ_ADMINISTRATOR_ROLE NO YES
    SA CLARIFY_ADMINISTRATOR YES YES
    SA CLARIFY_REPORTER YES YES
    SA CLARIFY_USER YES YES
    SA CONNECT YES YES
    SA EXECUTE_CATALOG_ROLE NO YES
    SA GATHER_SYSTEM_STATISTICS NO YES
    SA MOB_CONNECT YES YES
    SA SCHEDULER_ADMIN NO YES
    SA SELECT_CATALOG_ROLE YES YES
    (hidh403)/opt/app/adba/crmdb()> exp sa/fre9shen@t1crm9d2 file=sample.dmp log=sample.log
    Export: Release 11.2.0.2.0 - Production on Tue Jan 31 12:55:22 2012
    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Tes
    Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
    . exporting pre-schema procedural objects and actions
    . exporting foreign function library names for user SA
    . exporting PUBLIC type synonyms
    EXP-00008: ORACLE error 1031 encountered
    ORA-01031: insufficient privileges
    EXP-00000: Export terminated unsuccessfully

    Yes, I do agree.But when i compared with the other database where i am able to export it doesn't have the 'EXPORT_FULL_DATABASE' privs.
    SQL> select * from role_role_privs;
    ROLE GRANTED_ROLE ADM
    HS_ADMIN_ROLE HS_ADMIN_SELECT_ROLE NO
    ACCOUNT_CREATOR APPLICATION_USER YES
    APPLICATION_DBA APPLICATION_OEM_TUNE NO
    APPLICATION_DBA ACCOUNT_CREATOR NO
    EXECUTE_CATALOG_ROLE HS_ADMIN_ROLE NO
    HS_ADMIN_ROLE HS_ADMIN_EXECUTE_ROLE NO
    APPLICATION_DBA APPLICATION_DEVELOPER YES
    SELECT_CATALOG_ROLE HS_ADMIN_ROLE NO
    APPLICATION_DBA APPLICATION_USER YES
    SELECT_CATALOG_ROLE HS_ADMIN_SELECT_ROLE NO
    EXECUTE_CATALOG_ROLE HS_ADMIN_EXECUTE_ROLE NO
    ROLE GRANTED_ROLE ADM
    APPLICATION_DBA APPLICATION_CREATOR YES

  • "instead of" trigger on a view with a condition

    I'm trying to create an instead-of trigger on a view but I want it all such that:
    1. It fires only for a certain condition.
    2. When the condition isn't met, I want the normal DML on the view to continue as it normally would.
    3. I want to avoid writing as much manual DML code as possible for long-term maintainability.
    My first attempt is like this:
    create or replace trigger PROPOSAL_PARTS_V_IRU
      instead of update on proposal_parts_v
      for each row
      WHEN :old.PART_MASTER_ID <> :new.PART_MASTER_ID
    BEGIN
      do_stuff_for_part_master_change;
    END;So when the OLD and NEW PART_MASTER_IDs have changed, I want special processing. Else, I want it to do whatever it normally does (let the view get updated and the database will manage the update of the underlying table).
    When compiling that I get "ORA-25004: WHEN clause is not allowed in INSTEAD OF triggers".
    OK I will accept that even though I want it to work.
    So my next attempt could be:
    create or replace trigger PROPOSAL_PARTS_V_IRU
      instead of update on proposal_parts_v
      for each row
    BEGIN
      IF :old.PART_MASTER_ID <> :new.PART_MASTER_ID THEN
        do_stuff_for_part_master_change;
      ELSE
        UPDATE proposal_parts -- Manually update the underlying table with manually-written DML but I hate having to do this in case the view or table columns change.
        SET...
        WHERE...
      END;So my question is...is there any syntax to do something like this?
    create or replace trigger PROPOSAL_PARTS_V_IRU
      instead of update on proposal_parts_v
      for each row
    BEGIN
      IF :old.PART_MASTER_ID <> :new.PART_MASTER_ID THEN
        do_stuff_for_part_master_change;
      ELSE
        update_row;
      END;...where "update_row" is some sort of built-in command that tells oracle to continue with the current update as if the trigger never existed.
    Back in the day I seem to remember that Oracle Forms had a trigger and syntax like this where you could intercept a DML and if under certain conditions it wasn't true, you could say "update_row" (or maybe it was "update_record?...whatever) and it meant "continue with update as if this instead-of trigger never existed".
    Is anything available like that for the DB now? I know in older versions no, but we are now on 11g...anything new come out like this?
    Otherwise I have to manually write an update statement and I'd rather not if I don't need to.
    Thanks!

    riedelme wrote:
    gti_matt wrote:
    I'm trying to create an instead-of trigger on a view but I want it all such that:
    1. It fires only for a certain condition.You can use IF Logic inside a trigger to do or not do anything. As long as it is a condition you can check you can code IF logic around it
    2. When the condition isn't met, I want the normal DML on the view to continue as it normally would.You will have to code all of your logic in the INSTEAD of trigger. The whole purpose of the INSTEAD OF trigger is to execute INSTEAD OF performing DML on the view. There is no way to go back to the "normal DML" when the INSTEAD OF trigger exists.
    You can put all of the logic you will need in the INSTEAD OF trigger and use IF conditions. Use IF logic to code both your special and "normal" processing.
    3. I want to avoid writing as much manual DML code as possible for long-term maintainability.You will have to code the operative lines somewhere. Reusable functions and/or procedures in a package?Yep using an "IF" I knew about...no problem there.
    But was just looking for a cheap and easy way to say (for the "else" condition) to revert to normal DML processing. Sounds like in a DB trigger there is no such syntax I guess.
    This is an example from Oracle Forms, I was looking for a database equivalent of this(see http://sqltech.cl/doc/dev2000/help/fbhelp18.htm):
    Built-in Subprograms for On-Event Triggers For most of the transactional On-event triggers, there is a corresponding built-in subprogram.
    On-Event Trigger
    Corresponding Built-in
    On-Delete
    DELETE_RECORD
    On-Insert
    INSERT_RECORD
    On-Update
    UPDATE_RECORD
    When you call one of these built-in subprograms from its corresponding transactional trigger, Form Builder performs the default processing that it would have done normally at that point in the transaction.
    For example, if you call the INSERT_RECORD procedure from an On-Insert trigger, Form Builder performs the default processing for inserting a record in the database during a commit operation.
    When these built-ins are issued from within their corresponding transactional triggers, they are known as do-the-right-thing built-ins. That is, they do what Form Builder would normally have done at that point if no trigger had been present. Thus, an On-Insert trigger that calls the INSERT_RECORD procedure is functionally equivalent to not having an On-Insert trigger at all. Such a trigger is explicitly telling Form Builder to do what it would have done by default anyway.Note that the author calls them the "do-the-right-thing" built-ins. That's what I was looking for but on the DB side. Sounds like Oracle didn't come up with that (yet)?

  • Insert order by records into a view with a instead of trigger

    Hi all,
    I have this DML query:
    INSERT INTO table_view t (a,
                              b,
                              c,
                              d,
                              e)
          SELECT   a,
                   b,
                   c,
                   d,
                   e
            FROM   table_name
        ORDER BY   dtable_view is a view with an INSTEAD OF trigger and table_name is a table with my records to be inserted.
    I need the ORDER BY clause because in my trigger i call a procedure who treat each record and insert into a table, used in the view. I need to garantee these order.
    If i put an other SELECT statement outside, like this:
    INSERT INTO table_view t (a,
                              b,
                              c,
                              d,
                              e)
          SELECT   a,
                   b,
                   c,
                   d,
                   e
            FROM   table_name
        ORDER BY   dIt works. But I can put these new SELECT because these query is created automatic by Oracle Data Integrator.
    What I'm asking you is if there any solution to this problem without changing anything in the Oracle Data Integrator. Or, in other words, if there is any simple solution other than to add a new SELECT statement.
    Thanks in advance,
    Regards.

    Sorry... copy+paste error :)
    INSERT INTO table_view t (a,
                              b,
                              c,
                              d,
                              e)
        SELECT   *
          FROM   (  SELECT   a,
                             b,
                             c,
                             d,
                             e
                      FROM   table_name
                  ORDER BY   d)I need to insert him by a D column order, because my trigger needs to validate each record and insert him. I have some restrictions. For example, my records are:
    2     1     2006     M
    1     2     2007 M
    1     3     2007     S 2007
    1     2     2007     S 2007
    2     1     2009     S
    2     1     2009     S
    I want to insert the 'M' records first and then the 'S' records because the 'S' records only makes sense in target table is exists 'M' records
    Regards,
    Filipe Almeida

  • Error while selecting from a view ORA-01031: Insufficient privileges

    As DBA I have granted select privileges on a view to a user, but whenever I login as that user and try to select from the view I get the message 'ORA-01031'. When I run the query in the view as the user I do not have problem and can see the results. This view joins tables from more than one schema and does a distinct on the resultset. I am new to Oracle and would appreciate any help I can get.
    Thanks

    Back on this problem when I created another user with select permission on the same view and a default role that has reference on all the objects on the other schemas, I end up with the same error message. Although this time the schema owner of the view has select privileges on all the tables from other schemas referenced in the view.
    Thanks

  • Ora-01031 create view

    Hi,
    I'm trying to create a view as a select from tables of a diferent schema. I have create view privilege on my user, and select previlege on tables from the other schema.
    The select instructions run's ok in my schema and I can obtain results.
    But when I copy paste the select into a create view as instruction, it returns ora-01031.
    Can anyone help me?
    Thanks...
    Ricardo Feliciano

    in general everyone who owns an oracle user can select every table on the
    user of the aplication, Personally I think that is wrong. It's just not the way I build applications. However, if everybody did everything the same there wouldn't be any fun.
    However, if that's the general rule, then I don't see why you need rules. All you need is a parameterised script which accepts the name of a user and grants them SELECT on all the application owner's tables.
    If someone wants a view over object's they can view why not.I have a different philosophy of schema design. I think most users shouldn't have any DDL privileges so the question never arises.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • INSTEAD OF TRIGGER

    제품 : PL/SQL
    작성날짜 : 1999-07-13
    INSTEAD OF Trigger
    1. 개념
    INSTEAD OF trigger는 Oracle8에서 새로이 소개된 방법으로, DML문장에 의해
    직접 변경할 수 없는 view를 변경하기 위해 사용된다. 즉, base table이 fire
    하는 trigger를 생성하는 것이 아니고 view를 대상으로 trigger를 생성하여
    view에 대한 DML문장을 수행시 대신 trigger가 fire되어 base table을 직접
    변경하게 되는 것이다.
    기본적으로 DML이 불가능한 view는 다음 사항들을 포함하고 있는 경우이
    다. 이러한 사항을 포함한 view들에 대해서 instead of trigger를 생성하면 DML을
    수행할 수 있게 된다.
    (1) DISTINCT operator
    (2) group functions: AVG, COUNT, MAX, MIN, STDDEV, SUM, VARIANCE등
    (3) set operations: UNION, MINUS 등
    (4) GROUP BY, CONNECT BY, START WITH clauses
    (5) ROWNUM pseudocolumn
    (6) join (updatable join view인 경우는 제한적으로 DML수행가능 <Bul:11642>참
    조)
    2. EXAMPLE
    instead of trigger의 예를 다음과 같이 작성하였다.
    (1) base tables
    create table dept
    (deptno number(4) primary key,
    dname varchar2(14),
    loc varchar2(13));
    create table emp
    (empno number(4),
    ename varchar2(10),
    sal number(7,2),
    mgr number(4),
    deptno number(2) );
    (2) 직접 dml을 수행할 수 없는 view
    create view emp_dept
    as select empno, ename, sal, emp.deptno, dname
    from emp, dept where emp.deptno=dept.deptno;
    [참고] 이 예에서 dept table의 deptno가 primary key나 unique로 선언되어 있
    다면 emp_dept view는 updatable join view가 되어 key-reserved table인 emp table
    에 대한 dml은 trigger를 사용하지 않아도 직접 수행 가능하다. <Bul:11642>참

    (3) instead of trigger
    view에 DML을 수행시 내부적으로 수행되기를 원하는 logic을 임의로 user가
    작성하면 된다.
    아래의 예에서는 emp_dept에 insert문장을 수행하는 경우 기존에 존재하는
    dept정보에 대해서는 update를 수행하고, 새로은 dept정보는 insert하도록 하였다.
    그리고 emp table에 대해서는 empno가 primary key이므로 중복되는 row는
    자동으로 오류가 발생하게 되며, 새로운 값을 insert하게 되면
    emp table에 직접 insert를 하게 된다.
    create or replace trigger emp_dept_insert
    instead of insert on emp_dept
    referencing new as n
    for each row
    declare
    dept_cnt number;
    begin
    if :n.empno is not null then
    insert into emp(empno, ename, sal)
    values (:n.empno, :n.ename, :n.sal);
    end if;
    if :n.deptno is not null then
    select count(*) into dept_cnt
    from dept where deptno = :n.deptno;
    if dept_cnt > 0 and (:n.dname is not null) then
    update dept set dname = :n.dname where deptno = :n.deptno;
    else insert into dept(deptno, dname) values(:n.deptno, :n.dname);
    end if;
    end if;
    end;
    (4) DML statement
    다음과 같이 insert 문장을 view에 수행하면 emp_dept_insert trigger가
    fire되어 실제 emp와 dept table에 반영이 되어 emp_dept view에 insert가
    수행된 것 같이 보이게 된다.
    insert into emp_dept values (5000, 'EYKIM', 100, 10, 'SALES');
    insert into emp_dept(empno, ename, deptno) values (6000, 'YOUNKIM', 20);
    insert into emp_dept (empno, deptno, dname) values (7000, 50, 'NEW_DEPT');

    No, the INSTEAD OF trigger is on the View, and so only fires if you perform Insert/Update/Delete on the View.

  • Instead-of Trigger Complication.

    Hi folks,
    Please look at the following table to have a clear picture,
    I have 2 schemas namely, A and B.
    I have 2 objects also X and Y. These are tables in schema A but these same tables (with same structures and data also ) are views in schema B.
    In epitome, these X and Y views in schema B refer X and Y objects in schema A.
    I have a trigger in schema A wherein before the updation of X, the trigger updates table Y. This is working fine.
    Now, I have to write trigger T in schema B wherein before the updation of X, the trigger updates Y. But since both X and Y are views, obviously the trigger should be an INSTEAD-OF trigger and I want ot update the table Y in schema A (because Y in schema B is a view)
    In the update statement (in the trigger in schema B), my business logic does not support hardcoding schema names like the following statement is prohibited.
    update table A .Y set.....
    instead i should write
    update table Y set.....
    and the above statement should consider the table Y in schema A because in schema B Y is a view that refers table Y in schema A.
    How to achieve the desired result?
    first of all, is there need to write the instead-of trigger in schema B?
    If so how? How to reference the table in other schema without hardcoding its name?
    Please do help me.
    Your favour will be deeply appreciated.
    Cheers, PCZ
    schema object trigger
    A X,Y (tables) T
    B X,Y (Views) T

    What is purpose of creating views in schema B?. If it is for security reasons then the better option is to create synonym for tables in schema A. Schema A should grant privileges to schema B. Since both schemas are in the same database materialized views will not be beneficial.

  • Instead of trigger & forms

    Using Oracle 8.0.5 and
    Forms 5.0.6.8.0
    I created a view with an instead of trigger and I can insert rows using SQL.
    When i create a form with a block based on the view and I try to update a row, the form returns the error "FRM-40602 cannot insert or update data in a view"
    If I try to enter data in an item for insert, I get the error "FRM-40200 field is protected against update"
    All the block and item properties seem to be set correctly for insert and update.
    Why can't I insert or update?

    I think you want to post this question to the Developer 6.0 forum. This discussion forum is for JDeveloper, a different product.
    Laura

  • View with Instead of Trigger - ORA-01031

    I am having trouble with a form based on a view that uses an instead of trigger.
    When I attempt to update a complex view that uses instead of triggers in an APEX form, I get the following message:
    ORA-20001: Error in DML: p_rowid=21388, ... ORA-01031: insufficient privileges
    The view works correctly when updates are executed from SQL Plus.
    The view "VW" is based on several tables in the application schema "X", which is parsed by APEX, and several tables in another schema "Z". I have explicitly granted select permission on the tables in schema "Z" to schema "X", but this doesn't resolve the error.
    Any idea how to fix this problem? From reading other posts, it sounds like the only issue should be explicit grants on the tables in other schemas. I do not attempt to update the tables in schema "Z", and do not have update permissions to those tables.
    Sinerely, Justin

    Justin,
    you might try to grant the views to the FLOWS_xxxxx user, which performs the Apex processes.
    Dik Dral

  • Form with view having instead-of-trigger gives FRM-40501 and ORA-02014

    I created a data-entry from with a 'view' as datas-source block. This view gives crosstab query results with a data from a single base-table but it is complex and uses decode and aggregate funciton 'max' just to create group by in a crosstab query. I have created a instead of trigger on this view to update or insert a record in base table. A test to update base table works fine at SQl prompt. A test to insert at SQL shows '1 row created' but in fact when I query the database, it does not show newly inserted row. Also, when I compile and run this form, I get FRM-40501 and ORA-02014. Help!!!
    I know that DML operations on a view with DECODE, aggregate functions or group by can not be performed but I thought the "instead of" trigger on the view to update the base table should eleminate this restriction and hence pusued further but now stuck!
    BTW: I can post details of base table, view, and instead of trigger, if you want to see them to further decipher the problem. Just let me know. Thanks!
    VERSIONS: Forms in developer suite v10.1.2.0.2 on Windows XP 64 bit desktop - ; Backend database: 9.2.0.8 on Windows 2003 EE server
    Edited by: user8647268 on Aug 19, 2009 1:19 PM
    Edited by: user8647268 on Aug 19, 2009 1:25 PM

    I just forgot to ask you one question: In my experience with forms, I have captured before_value and after_value and implemented logic based on results many times. This form I am working on is kinda first multi-record form where I have a tabular page with date and about 7 other columns forming a grid of cells, which users wanted. Each line is a record from a view. I tried relying on forms to do DML on underlying table and since the underlying table is a paritioned table, I ran into FRM-40509 and ORA-00936, where returning ROWID becomes problematic. I found a note 167550.1 which says to set Key mode to 'Updateable' or 'Non-Updateable' but not 'Unique' or 'Automatic' as a solution #1. Solution#1 failed i.e. the errors persisted. The note also says in that case, implement Solution #2, which is to write explicit trigger to do each of the DML on view. Here I run into kinda problem: In a tabular form with say 31 records each row having 7 cells which is like capturing 217 before values..that is too many. Addressing them with ':old.xxx' or ':new.xxx' which works in instead of trigger, does not work in trigger inside forms. Without checking these before and after values, it inserts rows with nulls for empty cells where we wnated it to skip and do nothing. So iam looking for a way to capture before value using some kinda standard form mechanism..Do you have any suggestions! (Sorry for long explanation but that is the only way to do it..)

  • View and Instead of trigger

    Hi !
    In my application I have two tables
    tabA(col_A1,col_A2,col_A3) and tabB(col_B1,col_B2)I created a view
    CREATE OR REPLACE VIEW  vt
    AS SELECT  col_A1, col_A2, col_A3, col_B1, col_B2
         FROM  tabA  A
                 LEFT OUTER JOIN  tabB  B
                   ON (        A.ol_Achar = B.col_Bchar
                       OR 'A'||A.ol_Achar = B.col_Bchar ); and an instead of trigger
    CREATE OR REPLACE TRIGGER vt_upd
      INSTEAD OF UPDATE ON vt
    BEGIN
      UPDATE    tabA
         SET    col_A3 = :NEW.col_A3
         WHERE  col_A1 = :NEW.col_A1;
    END;
    /And now there are very strange behaviours on an update statement I've tried:
    UPDATE vt SET col_A3=1 where col_A1=2;1.) If I try it on an Oracle instance version 10.2.0.1.0 it's OK, the update (and hence the instead of triggers) does the right thing.
    2.) If I try it on an Oracle instance version 9.2.0.7.0 I get an error:
    ORA-01031: insufficient privileges3.) If I change the the definition to:
    CREATE OR REPLACE VIEW  vt
    AS SELECT  col_A1, col_A2, col_A3, col_B1, col_B2
         FROM  tabA  A
                 LEFT OUTER JOIN  tabB  B
                   ON A.ol_Achar = B.col_Bchar;the update will work on 9.2.0.7.0 as well.
    Any idea why there are such troubles ?
    Thanks for any help,
    Heinz

    Don't have 9.2.0.7 at hand and your view definition is a bit screwed. But what I tried was
    michaels>  create table taba(col_a1 varchar2(5),col_a2 varchar2(5),col_a3 varchar2(5))
    Table created.
    michaels>  create table tabb(col_b1 varchar2(5),col_b2 varchar2(5))
    Table created.
    michaels>  create or replace view vt
    as
       select col_a1, col_a2, col_a3, col_b1, col_b2
         from taba a left outer join tabb b
              on (a.col_a1 = b.col_b1 or 'A' || a.col_a2 = b.col_b2)
    View created.
    michaels>  create or replace trigger vt_upd
       instead of update
       on vt
    begin
       update taba
          set col_a3 = :new.col_a3
        where col_a1 = :new.col_a1;
    end vt_upd;
    Trigger created.
    michaels>  update vt
       set col_a3 = 1
    where col_a1 = 2
    0 rows updated.
    michaels>  select * from v$version
    BANNER                                                         
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production                          
    CORE     9.2.0.8.0     Production                                      
    TNS for HPUX: Version 9.2.0.8.0 - Production                   
    NLSRTL Version 9.2.0.8.0 - Production Maybe time to upgrade?

Maybe you are looking for

  • I erased a partition from the Desktop, can I get it back?

    I have a 733 MHz PowerPC G4, with one 40 gig hard drive with App's on it and a 300 gig with three partitions. Well while clearing old pictures from the desktop I throw away one partition and the 40 gig hard drive, then did a secure empty trash. Later

  • Jar file for starterwebapp||

    hello , i am trying to run sample web application and could not get the jar file for import oracle.ifs.common.IfsException; import oracle.ifs.management.domain.HttpServletNodeUtilities; import oracle.ifs.management.domain.Server; from where i can get

  • HT203167 What happened to the force unleashed on iPad?

    What happened to the Star Wars Force Unleashed game?  I had bought it sometime back, but now it is no longer on my iPad and I can't find it in the iTunes store.  what is going on?

  • Programmaticly change cluster size

    I'm i'm facing the following problem, i want to display several plots in a chart, to do this i'm using a build to cluster function, because the source is an array with N items. The sollution i came up to, was not correct because the cluster has a fix

  • How to update Safari on Snow Leopard IMac

    I have an IMac 10.6.8 Snow Leopard, 3.06 GHz Intel Core 2 Duo Have occasion to run Mail Chimp and it says Safari needs to be updated.  I've run my Software Update in the Apple Logo drop down box and it reports that all updates are already complete.