ORA-01779: cannot modify a column that is mapped to a table not preserved key

Hello
I'm doing update join with the type of activity of lag on my 10.2.0.3
Here's a simple test case:
create table test1 (id1 number, id2 number, before varchar2(10), after varchar2(10));

alter table test1 add constraint pk1 primary key (id1, id2);

SQL> insert into test1 values(1,1 , 'a','b');

1 row created.

SQL> insert into test1 values(1,2 , 'b','c');

1 row created.

SQL> commit;




select * from test1;

  ID1        ID2 BEFORE     AFTER
----- ---------- ---------- ----------
    1          1 a          b
    1          2 b          c



update
 (select src.before src_before, tgt.before tgt_before from test1 src , test1 tgt 
    where 
    src.id1 = tgt.id1 
and src.id2 = tgt.id2 + 1 )
set tgt_before  = src_before
/

set tgt_before  = src_before
    *
ERROR at line 2:
ORA-01779: cannot modify a column which maps to a non key-preserved table
Problem with tgt.id2 + 1, but I need that in my logic, so how do I get around this?
Concerning
GregG

Published by: 3 Sep 2012 GregG 13:23
removed and src.id2 = 1

Published by: 3 Sep 2012 GregG 13:31
Corrected as pointed by Dom

Have you tried something like this:

UPDATE test1 a
SET    a.before = (SELECT b.before
                   FROM   test1 b
                   WHERE  b.id1 = a.id1
                   AND    b.id2 = a.id2 - 1)
WHERE EXISTS (SELECT 1
              FROM   test1 c
              WHERE  c.id1 = a.id1
              AND    c.id2 = a.id2 - 1)

Tags: Database

Similar Questions

  • Cannot modify a column that is mapped to a table not preserved key

    I use Oracle 12 c.

    I get this error in updating the column in a TWG.

    Scripts to create the TWG, TABLE & Qry Oracle is provided below.

    GLOBAL TEMPORARY TABLE

    GLOBAL TEMPORARY TABLE

    CREATE GLOBAL TEMPORARY TABLE ROAD
    (
      SNO NUMBER(5, 0)
    , ROADID NUMBER(5, 0) NOT NULL
    , ROADNAME VARCHAR2(50 CHAR)
    , ROADSC VARCHAR2(10 CHAR)
    , SUBAREAID NUMBER(5, 0)
    , AREAID NUMBER(5, 0)
    , SEQNO NUMBER(5, 0)
    , SEQNOCUR NUMBER(5, 0)
    , ADDEDIT VARCHAR2(1 BYTE)
    , ISBULK NUMBER(1, 0)
    , ROWNO NUMBER(5, 0)
    , ERROR VARCHAR2(200 BYTE)
    , COMPID NUMBER(5, 0)
    , CONSTRAINT ROAD_PK PRIMARY KEY
      (
        ROADID
      )
      USING INDEX
      (
          CREATE UNIQUE INDEX ROAD_PK ON ROAD (ROADID ASC)
          NOPARALLEL
      )
      ENABLE
    )
    ON COMMIT DELETE ROWS;
    
    

    TABLE MROAD

    CREATE TABLE MROAD
    (
      ROADID NUMBER(10, 0) NOT NULL
    , ROADNAME VARCHAR2(50 CHAR)
    , SUBAREAID NUMBER(10, 0)
    , AREAID NUMBER(10, 0)
    , SEQNO NUMBER(10, 0)
    , ROADSC VARCHAR2(10 CHAR)
    , COMPID NUMBER(10, 0)
    , CONSTRAINT MROAD_PK PRIMARY KEY
      (
        ROADID
      ));
    
    

    CREATE PROCEDURE

    PROCEDURE ROAD_SAVE_NEW(
          v_Data XMLTYPE DEFAULT NULL)
      IS
        v_CompID  NUMBER(5):= 0;
        rc sys_refcursor;
      BEGIN
        INSERT
        INTO Road
         (
          SNO ,
          ROADID ,
          ROADNAME ,
          ROADSC ,
          SUBAREAID ,
          AREAID ,
          SEQNO ,
          SEQNOCUR ,
          ADDEDIT ,
          ISBULK ,
          COMPID
         )
    SELECT Row_Number() OVER(ORDER BY 1) SNo ,
          XT.* ,
          v_CompID
          FROM XMLTABLE('/QueryParam/RoadXML/Road'
          PASSING v_SPParamList
          COLUMNS "RoadID" NUMBER(5) PATH 'RoadID',
          "RoadName" VARCHAR2(50) PATH 'RoadName',
          "RoadSC" VARCHAR2(10) PATH 'RoadSC',
          "SubAreaID" NUMBER(5) PATH 'SubAreaID',
          "AreaID" NUMBER(5) PATH 'AreaID',
          "SeqNo" NUMBER(5) Path 'SeqNo',
          "SeqNoCur" NUMBER(5) Path 'SeqNoCur',
          "AddEdit" VARCHAR2(1) PATH 'AddEdit',
          "IsBulk" NUMBER(1) PATH 'IsBulk') XT;
       
         UPDATE
            (SELECT B.ERROR ERROR_0
            FROM MROAD A
            INNER JOIN  Road B       
            ON A.RoadID  != B.RoadID
            AND A.RoadSC  = B.RoadSC
            AND A.RoadSc != ''       
            )
           SET ERROR_0 = 'R114|Short Code Already Exist';
    
    END ROAD_SAVE_NEW;
    
    

    APPEAL PROCEDURE

    DECLARE
      xmlData XMLTYPE := XMLTYPE('<QueryParam>
      <RoadXML>
        <Road>
          <RoadID>0</RoadID>
          <AreaID>94</AreaID>
          <SubAreaID>3</SubAreaID>
          <RoadSC><![CDATA[SP]]></RoadSC>
          <RoadName><![CDATA[6th A Road]]></RoadName>
          <SeqNo>0</SeqNo>
          <SeqNoCur>0</SeqNoCur>
          <IsBulk>true</IsBulk>
          <AddEdit>A</AddEdit>
        </Road>
        <Road>
          <RoadID>0</RoadID>
          <AreaID>94</AreaID>
          <SubAreaID>3</SubAreaID>
          <RoadSC><![CDATA[RR]]></RoadSC>
          <RoadName><![CDATA[Sojati Gate Bari]]></RoadName>
          <SeqNo>0</SeqNo>
          <SeqNoCur>0</SeqNoCur>
          <IsBulk>true</IsBulk>
          <AddEdit>A</AddEdit>
        </Road>
        <Road>
          <RoadID>0</RoadID>
          <AreaID>94</AreaID>
          <SubAreaID>3</SubAreaID>
          <RoadSC><![CDATA[CR]]></RoadSC>
          <RoadName><![CDATA[6th A Road]]></RoadName>
          <SeqNo>0</SeqNo>
          <SeqNoCur>0</SeqNoCur>
          <IsBulk>true</IsBulk>
          <AddEdit>A</AddEdit>
        </Road>
        <Road>
          <RoadID>0</RoadID>
          <AreaID>94</AreaID>
          <SubAreaID>3</SubAreaID>
          <RoadSC><![CDATA[TR]]></RoadSC>
          <RoadName><![CDATA[TripoliyaRoad]]></RoadName>
          <SeqNo>0</SeqNo>
          <SeqNoCur>0</SeqNoCur>
          <IsBulk>true</IsBulk>
          <AddEdit>A</AddEdit>
        </Road>
      </RoadXML>
    </QueryParam>');
    BEGIN
      ROAD_SAVE_NEW(
        v_Data => xmlData
      );
    END;
    
    

    I Know Oracle applies UJVC on update on view joined queries.

    This is the result I get in mssql

    tab.PNG

    How do I do this in Oracle.

    Found the answer:

    CREATE OR REPLACE PROCEDURE proc_RoadSave
    AS
            xmlData XMLTYPE := XMLTYPE.CreateXML(
            '<QueryParam>  
                    <RoadXML>    
                    <Road>      
                            <RoadID>0</RoadID>      
                            <AreaID>94</AreaID>      
                            <SubAreaID>3</SubAreaID>      
                            <RoadSC><![CDATA[SP]]></RoadSC>      
                            <RoadName><![CDATA[6th A Road]]></RoadName>      
                            <SeqNo>0</SeqNo>      
                            <SeqNoCur>0</SeqNoCur>      
                            <IsBulk>1</IsBulk>      
                            <AddEdit>A</AddEdit>    
                    </Road>    
                    <Road>      
                            <RoadID>0</RoadID>      
                            <AreaID>94</AreaID>      
                            <SubAreaID>3</SubAreaID>      
                            <RoadSC><![CDATA[RR]]></RoadSC>      
                            <RoadName><![CDATA[Sojati Gate Bari]]></RoadName>      
                            <SeqNo>0</SeqNo>      
                            <SeqNoCur>0</SeqNoCur>      
                            <IsBulk>1</IsBulk>      
                            <AddEdit>A</AddEdit>    
                    </Road>    
                    <Road>      
                            <RoadID>0</RoadID>      
                            <AreaID>94</AreaID>      
                            <SubAreaID>3</SubAreaID>      
                            <RoadSC><![CDATA[CR]]></RoadSC>      
                            <RoadName><![CDATA[6th A Road]]></RoadName>      
                            <SeqNo>0</SeqNo>      
                            <SeqNoCur>0</SeqNoCur>      
                            <IsBulk>1</IsBulk>      
                            <AddEdit>A</AddEdit>    
                    </Road>    
                    <Road>      
                            <RoadID>0</RoadID>      
                            <AreaID>94</AreaID>      
                            <SubAreaID>3</SubAreaID>      
                            <RoadSC><![CDATA[TR]]></RoadSC>      
                            <RoadName><![CDATA[TripoliyaRoad]]></RoadName>      
                            <SeqNo>0</SeqNo>      
                            <SeqNoCur>0</SeqNoCur>      
                            <IsBulk>1</IsBulk>      
                            <AddEdit>A</AddEdit>    
                    </Road>  
                    </RoadXML>
            </QueryParam>'
            );
            rc sys_refcursor;
    BEGIN
    execute immediate 'truncate table GTT.Road';
            INSERT
            INTO    GTT.Road
                    (
                            SNO
                          , ROADID
                          , ROADNAME
                          , ROADSC
                          , SUBAREAID
                          , AREAID
                          , SEQNO
                          , SEQNOCUR
                          , ADDEDIT
                          , ISBULK
                          , ROWNO
                          , ERROR
                          , COMPID
                    )
            SELECT  row_number() OVER(ORDER BY 1) Sno
                  , XT.RoadID
                  , XT.RoadName
                  , XT.RoadSC
                  , XT.SubAreaID
                  , XT.AreaID
                  , XT.SeqNo
                  , XT.SeqNoCur
                  , XT.AddEdit
                  , XT.IsBulk
                  , CAST(0 AS NUMBER(5)) ROWNO
                  , CASE
                            WHEN mRoad.RoadID IS NOT NULL
                            THEN
                                    CASE
                                            WHEN XT.RoadSC = mRoad.RoadSC
                                                    AND XT.RoadName = mRoad.RoadName
                                            THEN 'XXX'
                                            WHEN XT.RoadSC = mRoad.RoadSC
                                            THEN 'R114|Short Code Already Exist'
                                            WHEN XT.RoadName = mRoad.RoadName
                                            THEN ',R104|Entry Already Exist'
                                    END
                            ELSE NULL
                    END ERROR
                  ,CAST(0 AS                                                           NUMBER(10)) COMPID
            FROM    XMLTABLE('/QueryParam/RoadXML/Road' PASSING xmlData COLUMNS RoadID NUMBER(10) PATH 'RoadID', RoadName VARCHAR2(50 CHAR) PATH 'RoadName', SubAreaID NUMBER(10) PATH 'SubAreaID', AreaID NUMBER(10) PATH 'AreaID', SeqNo NUMBER(10) PATH 'SeqNo', RoadSC VARCHAR2(10 CHAR) PATH 'RoadSC', SeqNoCur NUMBER(5) PATH 'SeqNoCur', AddEdit VARCHAR2(1 CHAR) PATH 'AddEdit', IsBulk NUMBER(1) PATH 'IsBulk') XT
            LEFT JOIN mRoad
            ON      XT.RoadID != mRoad.RoadID
                    AND (XT.RoadSC = mRoad.RoadSC
                    OR XT.RoadName = mRoad.RoadName)
                    AND XT.RoadSC IS NOT NULL;
    
    
            OPEN rc FOR SELECT * FROM GTT.Road Where Error IS NULL;
            sys.dbms_sql.return_result(rc,TRUE);
            OPEN rc FOR SELECT * FROM GTT.Road WHERE ERROR IS NOT NULL;
            sys.dbms_sql.return_result(rc,TRUE);
            
    
    
    END proc_RoadSave;
    

    Post edited by: Sunil K. I found my answer it is also what I did to solve the problem.

    I found my answer, you can see the end of the question where I put the solution.

    Thank you everyone who helped or at least tried to help.

    Kind regards.

  • SQL error: ORA-01779: cannot modify a column that matches a key examine

    Hi all

    The requirement is that I have two tables s_party_d and S_CONTACT_d. the need to update the column name with FST_NAME | ',' | Last_name when column rowid in both tables are equal. I used the query previously below: -.

    Update
    (select
    E1. Name,
    e.FST_NAME,
    Select
    Of
    s_party_d e1,
    E S_CONTACT_d
    where
    E1. Game of ROW_ID = e.ROW_ID)
    name = FST_NAME | ',' | LAST_NAME;

    But I get the error message when executing the query

    Error in the command line: 31 column: 3
    Error report:
    SQL error: ORA-01779: cannot modify a column that is mapped to a table not preserved key
    01779 00000 - 'impossible to change a column that is mapped to a non-preserved table at key'
    * Cause: An attempt was made to insert or update columns in a join finds out who
    map to a table not kept the key.
    * Action: Change the directly underlying base tables.

    Can U please tell me why this error and how to solve?

    Thank you
    Mathon

    Mathon wrote:

    So, I have to look into some other method... I can't achieve this using a single update statement...

    Well, no matter what you do you need to decide what FST_NAME | ',' | Name to use. As I already pointed out for each line of the line of the s_party_d table there are several rows in table S_CONTACT_d. Again, you must yo decide what S_CONTACT_d table row you want to use. For example:

    update s_party_d e1
       set e1.name = (
                      select  max(e.FST_NAME) ||', '|| max(e.LAST_NAME)
                        from  S_CONTACT_d e
                        where e1.ROW_ID=e.ROW_ID
                     )
     where e1.ROW_ID in (
                         select  e.ROW_ID
                           from  S_CONTACT_d e
                        )
    /
    

    SY.

  • Gets the error ORA-01779 after I added the column

    Hi, I'm a total newbie in APEX but collaborated with ordinary development Oracle (tables, views, packages, triggers, etc) for a number of years.

    I ve been assigned in order to respect an existing application to APEX. One task is to add a column to a single character named 'ACTIVE' to a database table and also present on a current project list page. The value can be 'Y' or 'n'. In the view which is the source of data for the project page ad 'Y' turned into 'Yes' and 'n' turned into 'no '. So far so good, everything works well.

    There is another page on which it is possible to create new or modify existing projects. This page uses a view as a source of data. On this page, I added a group of radiobutton that contains two options: 'Yes' and 'no '. When I select to edit a project in the project list page the second page is loaded and the correct option, 'yes' or 'No', is marked on the page. This group of radiobutton works exactly like a couple of other groups of radiobutton also represented with a single character column in the database. So far so good!

    However, when I try to save the project file by clicking on "Apply Changes" I get this error:

    ORA-20001: DML error: p_rowid = 50, ID = p_alt_rowid, p_rowid2 =, p_alt_rowid2 is. ORA-01779: cannot modify a column that is mapped to a table not preserved key

    What is the problem here? The new 'ACTIVE' column is added to the view, when I run the view I Don t get all records in duplicate, the underlying table has a column id as the primary key.

    Since I Don t know that APEX is under the hood it s hard tp what's wrong. Anyone knows the solution to this problem?

    / Magnus

    Hello Magnus,

    Is there an INSTEAD OF trigger defined on the view? Have you added the new column ACTIVE there too?

    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this response in marking it as useful or Correct ;-)

  • Error ORA-01779: table preserved key not on update

    Hello.

    I'm doing this update:
     UPDATE (
      SELECT aux.o_customer AS a1, 
        REGEXP_REPLACE(kna.kunnr,'^0*','') AS a2
      FROM payer_catalog cli, 
        customer_master_cat kna, 
        aux_customer aux
      WHERE aux.o_customer = cli.cte_num
        AND cli.cte_num = kna.cte_num
    ) SET a1 = a2; 
    What I get is:
    ERROR at line 1:
    ORA-01779: cannot modify a column that is mapped to a table not preserved key >

    I have read on the key preserved table, but I'm going through a difficult time. Given that I did not understand the concept. Your help is greatly appreciated, so I can understand the question.

    It's the table create:
    CREATE TABLE AUX_CUSTOMER
       (     KEY_GUIDE VARCHAR2(30 CHAR), 
         O_CUSTOMER VARCHAR2(10 CHAR), 
         O_NAME VARCHAR2(80 CHAR)
       );
    
    CREATE TABLE CUSTOMER_MASTER_CAT
       (     KUNNR VARCHAR2(10 BYTE), 
         NAME1 VARCHAR2(100 BYTE), 
         NAME2 VARCHAR2(100 BYTE), 
         CTE_NUM VARCHAR2(10 BYTE)
       ) ;
    
    CREATE TABLE PAYER_CATALOG
       (     CTE_NUM VARCHAR2(10 BYTE), 
         PAYER VARCHAR2(100 BYTE)
       );
    And some inserts:
    Insert into AUX_CUSTOMER (KEY_GUIDE,O_CUSTOMER,O_NAME) values ('171109366944  23/01/12','N001210514',null);
    Insert into AUX_CUSTOMER (KEY_GUIDE,O_CUSTOMER,O_NAME) values ('005107145536  23/01/12','N001210600',null);
    Insert into AUX_CUSTOMER (KEY_GUIDE,O_CUSTOMER,O_NAME) values ('666318008569  23/01/12','0000104574',null);
    Insert into AUX_CUSTOMER (KEY_GUIDE,O_CUSTOMER,O_NAME) values ('043188136629  23/01/12','N001210514',null);
    
    INSERT INTO CUSTOMER_MASTER_CAT (KUNNR,NAME1,NAME2,CTE_NUM) VALUES ('0000008147','HONDA MOTOR','COMPANY LTD','N001210514');
    Insert into CUSTOMER_MASTER_CAT (KUNNR,NAME1,NAME2,CTE_NUM) values ('0000009559','APPLE','INC','N001210515');
    Insert into CUSTOMER_MASTER_CAT (KUNNR,NAME1,NAME2,CTE_NUM) values ('0000104574','SAMSUNG ELECTRONICS ','INC',null);
    
    Insert into PAYER_CATALOG (CTE_NUM,PAYER) values ('N001210514','HONDA');
    Insert into PAYER_CATALOG (CTE_NUM,PAYER) values ('N001210515','EXTERNAL CUSTOMER');
    Insert into PAYER_CATALOG (CTE_NUM,PAYER) values ('N001210516','CELLULAR COMPANY');
    This are not the tables I have created, I just checked the information.
    Kind regards.

    Hello

    If it is not clear how to do an UPDATE, there is a good chance that the UPDATE is not the right tool for the job.
    Try instead MERGER.

    MERGE INTO     aux_customer     dst
    USING (
         SELECT    aux.key_guide
         ,       MIN ( REGEXP_REPLACE ( kna.kunnr
                                            , '^0*'
                                      )
                       )                     AS a2
         FROM      payer_catalog             cli
         ,       customer_master_cat       kna
         ,           aux_customer                  aux
         WHERE        aux.o_customer            = cli.cte_num
         AND       cli.cte_num                 = kna.cte_num
         GROUP BY  aux.key_guide
          )                    src
    ON    (dst.key_guide     = src.key_guide)
    WHEN MATCHED THEN UPDATE
    SET   dst.o_customer     = src.a2
    ;
    

    What are the results you want from the given sample data?
    The MERGE statement above let aux_customer that looks like this:

    KEY_GUIDE                      O_CUSTOMER O_NAME
    ------------------------------ ---------- ----------
    005107145536  23/01/12         N001210600
    043188136629  23/01/12         8147
    171109366944  23/01/12         8147
    666318008569  23/01/12         0000104574
    

    Whether you use the FUSION or the UPDATE, if you update the actual table or view online, please make sure that the query that produces the new product (at most) one value of 1 line for each line in the table updated.

  • Function table in pipeline and the key-preservation - (ORA-01779)

    Hey oraclers,

    If I had to use a function table in the pipeline to cover complex application logic, I rarely update a subset of...

    (simplified example)
    create type derived_t as object ( key integer, value varchar2(100) );
    create type derived_tc as table of result_t;
    
    create or replace function new_derivations( p_param varchar2 ) return derived_tc pipelined
    is
      l_derived derived_t;
    begin
     
      loop
        /* do stuff here */
        .....
        pipe row( l_derived );
      end loop;
    return;
    end;
    /
    
    create table derivations
    as 
    ( 
      key integer primary key,
      value varchar2(100)
    );
    
    
    insert into derivations select t.* from table( cast( new_derivations( 'test' ) as derived_tc ) ) t;
    But when I try...
    update ( 
       select d.rowid,
                d.key,
                d.value,
                t.value new_value
       from   derivations d,
                table( cast( new_derivations( 'test' ) as derived_tc ) ) t
       where d.key = t.key 
       and     d.key between :low_key and :high_key
    )
      set value = new_value;
    I get ORA-01779: cannot modify a column that is mapped to a table not preserved key...

    OK... so reading around us need to be able to tell Oracle that each row in the result set view is preserved key - the 'key' of derivations from the table column and the column "key" to the result of the function in the pipeline are unique (and compatible).

    Is it possible to hint Oracle (11.2.0.2.0 on Windows) to achieve this?

    Thanks muchly,.

    Lachlan Pitts

    You can rewrite this kind of update in a MERGE statement statement, which I think does not suffer the problem you are experiencing:

    merge into derivations d
    using (select t.key, t.value new_value from table( cast( new_derivations( 'test' ) as derived_tc ) ) t) s
    on (d.key = s.key and d.key between :low_key and :high_key)
    when matched then update set d.value = t.new_value
    

    (Not checked for syntax errors)

    You can also watch this:
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:760068400346785797

    Published by: Toon Koppelaars February 8, 2011 05:40

  • ORA-01779 during insertion

    Hi all

    Oracle database version: 10.2.0.4.0

    When inserting into the table, I get this error below.
    SQL> desc org_officer
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     OFFICER_STATUS                                     VARCHAR2(10)
     OFFICER_RANK                                       NUMBER(3)
     OFFICER_ACTIVE                                     VARCHAR2(1)
     PERSON_ID                                          NUMBER(10)
     BIOGRAPHICAL_INFO                                  VARCHAR2(4000)
     OFFICER_ID                                         NUMBER(19)
     ORG_ID                                             NUMBER(19)
    
    SQL> desc BID_XML_DATA_BK
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     XML_DATA                                           SYS.XMLTYPE(XMLSchema "http:
                                                        //www.schemas.th.com/IntBID03" Element "Inte
                                                        grationBID") STORAGE Object-
                                                        relational TYPE "Integration
                                                        BID1004_T"
     BID_INSERT_STAMP                                   DATE
     RN                                                 NUMBER(5)
     ORG_ID                                             NUMBER(19)
    
    insert into org_officer                                                        
    select  b.officer_status,  b.officer_rank, b.officer_active, b.person_id,      
    b.biographical_info, b.officer_id, a.org_id from bid_xml_data_bk a,            
    xmltable                                                                       
    (xmlnamespaces(default 'http://www.schemas.th.com/IntBID03'),      
    'IntegrationBID/Organization'                                                  
    passing a.xml_data                                                             
    columns                                                                        
    org_id   number(19) path '@ID',                                                
    data_fragments xmltype path 'OfficerInformation'                               
    ) key_map,                                                                     
    xmltable                                                                       
    ('OfficerInformation/Officer'                                                  
    passing key_map.data_fragments                                                 
    columns                                                                        
    officer_status VARCHAR2(10) path '@Status',                                    
    officer_rank number(3) path '@Rank',                                           
    officer_active varchar2(1) path '@Active',                                     
    person_id  number(10) path 'Person/@ID',                                       
    officer_id number(19) path '@ID',                                              
    biographical_info varchar2(4000) path 'BiographicalInformation/Text'           
    ) b; 
    insert into org_officer
    *
    ERROR at line 1:
    ORA-01779: cannot modify a column which maps to a non key-preserved table
    Could someone help me please to insert. I am able to select and create a new table by using this statement select but not possible to insert using this select statement.

    NOTE: org_officer is not a view. And there is no constrants in the two tables.
    SQL> select dbms_metadata.get_ddl('TABLE','BID_XML_DATA_BK','COMMON') from dual;
    
    DBMS_METADATA.GET_DDL('TABLE','BID_XML_DATA_BK','COMMON')
    --------------------------------------------------------------------------------
    
      CREATE TABLE "COMMON"."BID_XML_DATA_BK"
       (    "XML_DATA" "SYS"."XMLTYPE" ,
            "BID_INSERT_STAMP" DATE,
            "RN" NUMBER(5,0),
            "ORG_ID" NUMBER(19,0)
       ) XMLTYPE COLUMN "XML_DATA" XMLSCHEMA "http://ww
    w.schemas.th.com/IntBID03" E
    LEMENT "IntegrationBID" ID 4691
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
     NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MIN
    EXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BU
    FFER_POOL DEFAULT)
      TABLESPACE "COMMON_DATA"
    
    
    SQL> select dbms_metadata.get_ddl('TABLE','BID_XML_DATA_BK','COMMON') from dual;
    
    DBMS_METADATA.GET_DDL('TABLE','BID_XML_DATA_BK','COMMON')
    --------------------------------------------------------------------------------
    
      CREATE TABLE "COMMON"."BID_XML_DATA_BK"
       (    "XML_DATA" "SYS"."XMLTYPE" ,
            "BID_INSERT_STAMP" DATE,
            "RN" NUMBER(5,0),
            "ORG_ID" NUMBER(19,0)
       ) XMLTYPE COLUMN "XML_DATA" XMLSCHEMA "http://ww
    w.schemas.th.com/IntBID03" E
    LEMENT "IntegrationBID" ID 4691
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
     NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MIN
    EXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BU
    FFER_POOL DEFAULT)
      TABLESPACE "COMMON_DATA"
    -Yasser

    Published by: YasserRACDBA on April 13, 2010 15:48

    Done next assistance

    ORA-01779, impossible to get right for

    forget the note == false xmltype ==

    Published by: Marco Gralike, October 20, 2010 20:04

  • v4.0 - in the form of ORA-01445: cannot select ROWID from where sample,.

    Hello
    I have created a form in table form in version 4.0.
    Selection is based on three tables that have primary keys, the keys are selected, and whenever I run the page I get the following error:-
    Failed to parse the SQL query:
    ORA-01445: cannot select ROWID, or sample, join without table views preserved key

    The query runs very well in the TOAD

    Any ideas?

    Thank you

    Mike
    ___________________________________________________________________________________
    Select
    CTR. PERF_RATING_LINE_ID,
    CTR. PERF_RATING_LINE_ID PERF_RATING_LINE_ID_DISPLAY,
    CTR. BUSINESS_UNIT,
    CTR. EMPLID,
    ''''|| CTR. REVIEW_YEAR REVIEW_YEAR,
    CTR. REVIEW_PERIOD,
    CTR. PERFORMANCE_SCORE,
    CTR. MODERATED_SCORE,
    CTR. HUMAN RESOURCES MANAGEMENT,
    PRL.COMMENTS,
    ACB. BU_DESC,
    ''''|| ACB. DEPTID DEPTID,
    ACB. DEPT_DESC,
    ACB. EMPLOYEE_NAME,
    ACB. GRADE,
    CTR. SCORE_APPROVED_BY,
    ACB. TEMP_PERM,
    ACB. GENDER,
    ACB. JOB_START_DATE,
    decode (DECODE (SUBSTR (ACB. FLAG, 1, 5), "S Job", substr (CPR. FLAG, instr (CPR. FLAG,'~ ', 1) + 2, 3));
    "HIR", "Committed", "XFR", "Transfer", "REH", "recall").
    Decode (SUBSTR (ACB. FLAG, 1, 30), "work starts the period ~ XFR ',' - ' | substr (CPR. FLAG, instr (CPR. FLAG,'~ ', 1, 2) + 2)) JOB_START_DETAILS,.
    ACB. APPOINTMENT_DATE,
    SUBSTR (CPR. JOB_END_DETAILS, INSTR (CPR. JOB_END_DETAILS,'~ ', 1, 2) + 2) JOB_END_DATE.
    SUBSTR (CPR. JOB_END_DETAILS, INSTR (CPR. JOB_END_DETAILS,'~ ', 1, 1) + 2, INSTR (CPR. JOB_END_DETAILS,'~ ', 1, 2) - INSTR (CPR. JOB_END_DETAILS,'~ ', 1, 1)-2) REASON,
    ACB. JOB_GROUP,
    ACB. JOB_GROUP_DESC,
    ACB. JOBCODE,
    ACB. JOBCODE_DESC JOB_DESC,
    ACB. JOB_FAMILY,
    ACB. JOB_FAMILY_DESC,
    ACB. PBR_ID,
    MD. MGR_DEPT_ID
    PERFORMANCE_BASE_REFRESH_V ACB,.
    PERFORMANCE_RATING_LINE PRL,
    Y00_OPR_MGR_DEPT MD
    WHERE (PRL. BUSINESS_UNIT = ACB. BUSINESS_UNIT
    AND PRL. EMPLID = ACB. EMPLID
    AND PRL. REVIEW_YEAR = ACB. REVIEW_YEAR
    AND PRL. REVIEW_PERIOD = ACB. REVIEW_PERIOD)
    AND MD. OPRID =: APP_USER
    AND INSTR (': ' |) MD. DEPTS_MANAGED |': ',' :'|| ACB. DEPTID |': ') > 0
    AND MD. MGR_DEPT_ID > 0
    AND CPR. ADMIN_CENTRE IN
    (select c.deptid AC
    of PSHR. PSOPRDEFN@PSHR. CSIR.CO. ZA,.
    PSHR.PS_SCRTY_TBL_DEPT@PSHR. CSIR.CO. ZA C
    where A.ROWSECCLASS = C.ROWSECCLASS
    AND C.DEPTID! = 'ZZZZ '.
    and a.oprid =: APP_USER)
    AND (: P2210_BUSINESS_UNIT IS NULL)
    OR PBR. BUSINESS_UNIT =: P2210_BUSINESS_UNIT)
    AND (: P2210_EMPLOYEE_NAME IS NULL)
    OR INSTR (UPPER (CPR. Employee_name), UPPER (:P2210_EMPLOYEE_NAME)) > 0)
    AND (: P2210_DEPARTMENT IS NULL)
    OR PBR. DEPTID =: P2210_DEPARTMENT)
    AND (: P2210_PERFORMANCE_RATING IS NULL)
    OR PBR. PERFORMANCE_SCORE =: P2210_PERFORMANCE_RATING)
    AND (: P2210_MODERATED_RATING IS NULL)
    OR PBR. MODERATED_SCORE =: P2210_MODERATED_RATING)
    AND (: P2210_GRADE IS NULL)
    OR PBR. CATEGORY =: P2210_GRADE)
    AND (: P2210_PERM_TEMP IS NULL)
    OR PBR. TEMP_PERM =: P2210_PERM_TEMP)
    AND SUBSTR (NVL (ACB. (JOB_END_DETAILS, "XXX"), 1, 3) NOT ("TER", "TOC")
    AND PRL. SCORE_APPROVED_BY IS NULL

    Mike,

    We also changed our Wizard to create only validations for columns that are selected to be updated (in the wizard on the page in a table). And in the case of the application wizard, we examine if the columns have been excluded on the edit page popup page, and they are set to read-only through the default user interface. If you should only get validations for the columns that are modifiable, view-only / save state or hidden. We include only display / save state and hidden, because in both cases, you have actual shape on your page elements, which could easily be manipulated through common web tools.

    Kind regards
    Marc

  • Cannot find the left column that used to be on the documents and photo files.

    Cannot find the left column that used to be on the documents and photo files. On this missing column I know was there before, had options fax, copy and other things we could do with these files. I want to get that back. Thank you.

    With my Documents folder open, go to Toolsand then click on Options files . On the general tab, tasks section, choose Show tasks in folders.

    I would like to know if it works. Thank you.

  • ORA 01407 - cannot update column null - but I put as possible null

    Hi, I want to change the column datatype varchar2 to the number, but I have given in the column and I can not remove this column from table so I try this:

    change table tux

    Add subscribe_type_copy number (3);

    updated tux

    Set subscribe_type_copy = subscribe_type;

    change table tux

    change (subscribe_type, null);

    updated tux

    Set subscribe_type = null;

    -mistake here: ORA-01407: cannot update ("TUX". "" NOTIFY ". (' "SUBSCRIBE_TYPE") with the NULL value

    -- ? Why? I changed the column to accept NULL value

    -I want to do it now:

    change table tux

    Edit)

    subscribe_type number (3) - precision (total number of digits)

    );

    concerning

    What is FK or Pk?

    HTH - Antonio NAVARRO

  • ORA-12032: cannot use column rowid

    Hello
    8.1.7 I have the following error:
    ORA-12032: cannot use the rowid column of materialized view log on 'chain '. "' string '.
    The solution is:
    Action: A full refresh is necessary before the next quick update. Add columns ROWID in the materialized view log, if necessary.


    How can I do a complete refresh before the next fast refresh or ROWID columns add? How do I know whether the ROWID columns add?
    Thank you.

    PS:
    my script is:
    ................
    ..............
    START WITH TO_DATE (July 6, 2010 17:57:48 "," dd-mon-yyyy hh24:mi:ss')
    NEXT SYSDATE + 1/24

    user522961 wrote:
    Hello
    8.1.7 I have the following error:
    ORA-12032: cannot use the rowid column of materialized view log on 'chain '. "' string '.
    The solution is:
    Action: A full refresh is necessary before the next quick update. Add columns ROWID in the materialized view log, if necessary.

    How can I do a complete refresh before the next fast refresh or ROWID columns add? How do I know whether the ROWID columns add?
    Thank you.

    run up

    EXECUTE DBMS_MVIEW.REFRESH('MV_NAME','C');
    
  • Addition of constraint not Null to a column that contains null values

    All,

    Could you please suggest me how to add the constraint not null to an existing column that has null values?

    SQL > create table nn (number n, s varchar2 (10));

    Table created.

    SQL > insert into nn values (1, 'test');

    1 line of creation.

    SQL > insert into values nn (2 '');

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > alter table nn edit n number not null;

    Modified table.

    SQL > nn desc;

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    N NUMBER NOT NULL

    S                                                          VARCHAR2(10)

    SQL > alter table nn edit n number null.

    Modified table.

    SQL > nn desc;

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    N                                                  NUMBER

    S                                                  VARCHAR2(10)

    SQL > alter table nn change s varchar2 (10) not null;

    ALTER table nn change s varchar2 (10) not null

    *

    ERROR on line 1:

    ORA-02296: impossible to activate (SCOTT) - found null values

    SQL >

    Thank you

    Use NOVALIDATE:

    SQL > alter table nn change s varchar2 (10) not null;
    ALTER table nn change s varchar2 (10) not null
    *
    ERROR on line 1:
    ORA-02296: impossible to activate (SCOTT) - found null values

    SQL >
    SQL > alter table nn change s varchar2 (10) not null NOVALIDATE;

    Modified table.

    SQL > insert into values nn (3, null);
    insert into nn values (3, null)
    *
    ERROR on line 1:
    ORA-01400: cannot insert NULL into ('SCOTT'. "' NN '. » S »)

    SQL > select * from nn;

    N S
    ---------- ----------
    1 test
    2

    SQL >

    SY.

  • ORA-01445: cannot select ROWID, or sample, a view of join without key - preserved table form w/report and LOV

    I create a page "Form on a Table with Report" (APEX 5). Table I has 3 columns: cat_key, item_value, item_description. The cat_key is a foreign key in a table with columns cat_key, cat_value. I created the report and everything works fine.  The page of the report shows my domain cat_key in number, so I want it instead to display the cat_value. I change the field cat_key to a text based on LOV, select my LOV and now when I view the page of report I get the "'ORA-01445: cannot select ROWID from where sample, a join without key preserved table view ' error." The report uses the ROWID as a link to the edit page field.

    If I use the same tables and even shared LOV in a report page interactive, it works fine.

    What I am doing wrong?

    This is a limitation of the IR Apex will rewrite your query to a query that includes the lookup table and the columns. So now you have actually created a query on an inline view, which causes the error. You can see the query apex created when running in debug mode. APEX will join the table of choice with your primary table. For example from one of my IR:

    Select 'ID '...

    "MSL". "" HIS_COUNTRIES "=> my primary table

    ) ) b,

    (select rv_meaning d, rv_low_value r

    of msl_ref_codes_table

    where rv_domain = "JOHN".

    ) L1 = > query My LOV Lookup

    ...

    So, if possible, base your reports and forms on the real primary key, no rowid.

    You can also write the IR query with the search yourself:

    Select T1.rowid...

    of primary_table T1

    look_table L1

    ...

  • Why I don't have the error: ORA-14551: cannot perform a DML operation inside a query

    Hello

    create table table_1 (phone number)

    create or replace function function_a return number
      is
        l_rv number;
      begin
        l_rv := dbms_random.value();
        insert into table_1 values(l_rv);
        return l_rv;
      end;
    
    

    Select double function_a

    Now, I get the error:

    ORA-14551: cannot perform a DML operation inside a query

    ORA-06512: at "FUNCTION_A", line 6

    create the table table_2 (phone number)

    insert into table_2 select function_a from dual
    
    

    Now, I make the same mistake. It is to insert records into table_2

    Can someone please clarify this?

    Database Oracle 12 c Enterprise Edition Release 12.1.0.1.0 - 64 bit Production

    Post edited by: O - O added: (select double function_a)

    O - O wrote:

    To be called from instructions SQL, stored function must obey "purity" following rules, which are intended to control the side effects:

    • rule1) When it is called from a SELECT statement or a parallelized INSERT , UPDATE , or DELETE statement, the function cannot change database tables.
    • rule2) When it is called from a INSERT , UPDATE , or DELETE statement, the function cannot query or modify database tables modified by that statement.

    Can you please explain this? I think that these statements are contradicted with

    insert into select double function_a table_2

    Now, I make the same mistake. It is to insert records into table_2

    When your function is called by a select statement, an error is triggered because of rule1).

    When your function is called in an insert statement, no error is raised. The insert does not work in parallel (this is an insert row after all). So rule1) is also not infringed. The insert is on the table2, change table1. Because it does not modify the same table rule2) is not violated. So no reason to trigger an error.

  • ORA-19504: cannot create the file '+ DATA '.

    Hello everyone.

    This is the scenario:

    We have a test server that is used to restore daily backups of the Production database. Restore us the database with the same SID as the production one.

    For specific reasons, we need create a second database (with a different SID) on this server with an older backup from the production one. To realize that I'm trying to use a part of the "DUPLICATE without connection to the target" tutorials on the web.

    I tried the simple guide that I found which is:

    (1) copy the backup files cold /somedirectory

    (2) start OLD database with nomount

    (3) connect RMAN with OLDER as an auxiliary

    (4) run the following: DUPLICATE DATABASE FOR OLD BACKUP LOCATION ' / somedirectory' NOFILENAMECHECK.

    Here's the result (I deleted some lines because of the size of it):

    ----------------------

    RMAN > ProdDB to OlderDB DUPLICATE DATABASE

    2 > LOCATION of BACKUP "/ home/oracle/OlderBackupFiles.

    3 > NOFILENAMECHECK.

    4 >

    From October 1, 14 Db double

    content of Script memory:

    {

    clone of SQL 'alter system set control_files =

    "+DATA/OlderDB/controlfile/current.829.859839217" comment =

    ' Set by RMAN "scope = spfile;

    clone of SQL 'alter system set = db_name

    "ProdDB" comment =

    ' Modified by RMAN duplicate "scope = spfile;

    clone of SQL 'alter system set db_unique_name =

    "OlderDB" comment =

    ' Modified by RMAN duplicate "scope = spfile;

    clone to stop immediately;

    Start clone force nomount

    Restore controlfile primary clone of ' / home/oracle/OlderDB/controlfile_ProdDB_20141001_4159.bkp';

    change the clone database mount;

    }

    execution of Script memory

    SQL statement: alter system set control_files = comment "+DATA/OlderDB/controlfile/current.829.859839217" = "defined by RMAN" scope = spfile

    SQL statement: change the system db_name set = comment "ProdDB" = "modified by RMAN duplicate" scope = spfile

    SQL statement: alter system set db_unique_name = comment "OlderDB" = "modified by RMAN duplicate" scope = spfile

    (...)

    From restoration to 1 October 14

    allocated channel: ORA_AUX_DISK_1

    channel ORA_AUX_DISK_1: SID = 191 type device = DISK

    channel ORA_AUX_DISK_1: restore the control file

    channel ORA_AUX_DISK_1: restoration complete, duration: 00:00:03

    output file name=+DATA/OlderDB/controlfile/current.829.859839217

    Restoration finished in October 1, 14

    mounted database

    output channel: ORA_AUX_DISK_1

    allocated channel: ORA_AUX_DISK_1

    channel ORA_AUX_DISK_1: SID = 191 type device = DISK

    content of Script memory:

    {

    until the SNA 274262921.

    the value of newname for datafile clone 1 again;

    the value of newname for datafile clone 2 again.

    the value of newname for datafile clone 3 again.

    the value of newname for datafile clone 4 new ones;

    the value of newname for datafile clone 5 again.

    the value of newname for datafile clone 6 again.

    the value of newname for datafile clone 7 again.

    restoration

    database clone;

    }

    (...)

    From restoration to 1 October 14

    using the ORA_AUX_DISK_1 channel

    channel ORA_AUX_DISK_1: from the restore backup set data file

    channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

    channel ORA_AUX_DISK_1: restore datafile 00001 to + DATA

    channel ORA_AUX_DISK_1: restore datafile 00002 to + DATA

    channel ORA_AUX_DISK_1: restore datafile 00003 to + DATA

    channel ORA_AUX_DISK_1: restore datafile 00004 in + DATA

    channel ORA_AUX_DISK_1: restore datafile 00005 to + DATA

    channel ORA_AUX_DISK_1: restore datafile 00006 to + DATA

    channel ORA_AUX_DISK_1: restore datafile 00007 to + DATA

    channel ORA_AUX_DISK_1: reading from the backup /home/oracle/OlderDB/database_ProdDB_20141001_4157.bkp piece

    channel ORA_AUX_DISK_1: ORA-19870: error when restoring the backup /home/oracle/OlderDB/database_ProdDB_20141001_4157.bkp piece

    ORA-19504: cannot create the file '+ DATA '.

    ORA-17502: ksfdcre:4 cannot create the file + DATA

    ORA-15041: diskgroup space 'DATA' exhausted

    switch to the previous backup

    Oracle instance started

    (...)

    content of Script memory:

    {

    clone of SQL 'alter system set = db_name

    "OlderDB" comment =

    ' Restore the original value by RMAN "scope = spfile;

    clone of SQL 'alter system reset db_unique_name scope = spfile;

    clone to stop immediately;

    }

    execution of Script memory

    Errors in the script of the memory

    RMAN-03015: an error has occurred in the script stored memory Script

    RMAN-06136: the auxiliary database ORACLE error: ORA-01507: database not mounted

    ORA-06512: at "SYS." "X$ DBMS_RCVMAN ', line 13466

    ORA-06512: at line 1

    RMAN-05556: not all data files have backups can be recovered on SNA 274262921

    RMAN-03015: an error has occurred in the script stored memory Script

    RMAN-06026: some targets not found - abandonment of restoration

    RMAN-06023: no backup or copy of the file 4 found to restore

    RMAN-06023: no backup or copy of datafile 3 found to restore

    RMAN-06023: no backup or copy of datafile 2 found to restore

    RMAN-06023: no backup or copy of datafile 1 found to restore

    RMAN-00571: ===========================================================

    RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =.

    RMAN-00571: ===========================================================

    RMAN-03002: failure of the command duplicate Db at 15:39:11 01/10/2014

    RMAN-05501: abandonment of duplicate target database

    Complete recovery manager.

    ------------------------------------------------------------------

    The first mistake of the stack was ORA-19504 while trying to restore the backup of the database.

    First thing I took a glance was ASM occupation but it enough available space.

    The second was a permission problem, but it doesn't seem to be the case because RMAN can correctly write the controlfile to ASM.

    One have some advice on what I should look for?

    Thanks in advance sorry for my English.

    Select this option.

    Hello.

    Thanks, but is not the case. As I have said, that the DATA diskgroup has space enough he uses only a single disk in a RAID.

    But I solved my problem... To the auxiliary database, I added the following to the spfile:

    DB_FILE_NAME_CONVERT = '+ DATA/ProdDB', '+ DATA/OlderDB ".

    LOG_FILE_NAME_CONVERT = '+ DATA/ProdDB', '+ DATA/OlderDB ".

    I don't know why, but with these two clauses, it worked well. Perhaps RMAN was trying to restore it to the wrong place?

Maybe you are looking for

  • Where can I download Toshiba recovery disc creator?

    Hi where can I download toshiba recovery disc creator? I have this model [Satellite A300 - 146 PSAJ0E | http://eu.computers.toshiba-europe.com/innovation/jsp/SUPPORTSECTION/discontinuedProductPage.do?service=EU&PRODUCT_ID=1 50528]. I cand find maybe

  • 7500 a OfficeJet won't print from the Internet

    My printer portable e-all-in-one Officejet 7500 a wide can suddenly will not print on the Internet after that only three years ago. What could be the problem and how to fix it?

  • measuremnt of vibration: SVT versus SVMS

    Hello world I have a connected to a NI 9234 accelometer and I need to get the level of vibration (in mm/s) and send it to a spreadsheet all the 1 sec. I have no sound and Vibration, and I do not know her. Financial worry, I wonder if I just need the

  • Windows Vista crash, said of recovery is full. How can I remove recovery?

    My wife inspiron 530 s Dell has a full recovery. How can I fix it?

  • Loading Vista bar hangs

    I was watching a tv show on my laptop in the crash all of a sudden. Now every reboot my laptop it gets just stuck on the loading bar. I tried safe mode and all the other options, but it does not load. When loading in safe mode, it gets stuck at the c