Table preserved key questions

I have a question, that was triggered from this thread:

{: identifier of the thread = 2331412}

Version
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Setup
DROP TABLE t1 PURGE;
DROP TABLE t2 PURGE;

CREATE TABLE t1
( t1_pk  NUMBER PRIMARY KEY
, t1_dat NUMBER UNIQUE
);

CREATE TABLE t2
( t2_pk     NUMBER
, t2_dat_pk NUMBER
, CONSTRAINT t2_pk PRIMARY KEY (t2_pk, t2_dat_pk)
);

INSERT INTO t1(t1_pk, t1_dat) VALUES (1,5);
INSERT INTO t1(t1_pk, t1_dat) VALUES (2,4);
INSERT INTO t1(t1_pk, t1_dat) VALUES (3,3);
INSERT INTO t1(t1_pk, t1_dat) VALUES (4,2);
INSERT INTO t1(t1_pk, t1_dat) VALUES (5,1);

INSERT INTO t2(t2_pk, t2_dat_pk) VALUES (1,5);
INSERT INTO t2(t2_pk, t2_dat_pk) VALUES (2,3);
INSERT INTO t2(t2_pk, t2_dat_pk) VALUES (3,1);

COMMIT;
Problem

The Oracle documentation States the following on the preservation of the keys:
A table is preserved in key if all keys in the table can also be a key to the result of the join. Thus, a key preserved table has its keys preserved thanks to a join. For example, a table preserved key with its preserved thanks to a join keys.
If I try the next update:
UPDATE ( SELECT t1.t1_dat
              , t2.t2_dat_pk
         FROM   t1
         JOIN   t2 ON t2.t2_dat_pk = t1.t1_dat
         WHERE  t2.t2_pk = 1
       )
SET    t1_dat = NULL
;
It fails with the:
ORA-01779: cannot modify a column which maps to a non key-preserved table
The following questions come to mind:

1. with the following queries of this type of installation could it every being a situation where T2 lines are not identified? If yes - that someone can provide an example?

2. If it is not possible, how is it Oracle doesn't realize that T2 lines are particularly well identified (for example, a key to the join)?

I also tried the following variations:
UPDATE ( SELECT t1.t1_dat
              , t2.t2_dat_pk
         FROM   t1
         JOIN   t2 ON  t2.t2_dat_pk = t1.t1_dat
                   AND t2.t2_pk     = 1
       )
SET    t1_dat = NULL
;
UPDATE ( SELECT t1.t1_dat
              , t2.t2_dat_pk
         FROM   t1
         ,      t2 
         WHERE  t2.t2_dat_pk = t1.t1_dat
         AND    t2.t2_pk     = 1
       )
SET    t1_dat = NULL
;
Most probably I'm probably just not understand something minute here. If yes I appreciate be educated. :)

Good timing :)

http://jonathanlewis.WordPress.com/2012/01/06/i-wish-5/

Appears to be relatively the same question. I guess the short answer is that there are just a few things that the optimizer cannot do at the moment... maybe in the next version?

Tags: Database

Similar Questions

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

  • doubt in preserved key

    Hello

    in what preserved base table key is known or which criteria to say this table preserved key

    If you try to update a view (inline or other), the column, or columns that you want to update must map to a key preserved table. In other words, Oracle must be able to determine that one line in the output of the view defined cards on a single line in the base table.

    For example, the EMP and DEPT tables. If you have created a view

    CREATE VIEW emp_to_dept
    AS
    SELECT e.empno, e.ename, d.dname
      FROM emp e,
           dept d
     WHERE e.deptno = d.deptno
    

    ENAME and EMPNO column would be editable because the EMP table in this query is stored at the key. There is a primary key on column EMPNO, EMP and a foreign key between the EMP and DEPT on DEPTNO tables which ensure that all lines of EMP_TO_DEPT corresponds to one line in the EMP table. This means that Oracle can understand what line of the EMP table, you want to update.

    However, the DNAME column is not editable because the DEPT table in this query is not stored in the key. DEPT is the child table, a single line in the DEPT table can map to multiple lines in the view of the EMP_TO_DEPT results.

    Justin

  • computer laptop 15-f337wm: 10 hp 15 laptop windows esc key, question mark does not, even on the touch screen

    New laptop. Œuvres ESC key, question mark on the keyboard displays windows 10 help, question mark on the screen touch sometimes works. K button sometimes works as input.

    Downloaded Mozilla Firefox protection problem in the past, for now...

  • key questions that need to be addressed as a result of Microsoft removed support for Windows XP in 2014

    I'm looking to find some key questions that need to be addressed as a result of Microsoft removed support for Windows XP in 2014

    If you have links to areas would be great.

    I know more obvious as security and updates, drivers, hardware support - would be good to have a list that is known. mainly on the basis of the company.

    Thank you very much

    I'm looking to find some key questions that need to be addressed as a result of Microsoft removed support for Windows XP in 2014

    If you have links to areas would be great.

    I know more obvious as security and updates, drivers, hardware support - would be good to have a list that is known. mainly on the basis of the company.

    Thank you very much

    Stop using XP in April 2014.

    Although I know that some companies still using Windows 2000, so...

    You're not real specific-, but the basic answer to your question is to find a list of the updates through the catalogue and download/save to some media.  Integrate as much as possible in support of installation that you plan to use after the date of 'dead' of the then 13 year operating system and several.

    Drivers are not the responsibility of Microsoft unless it happens to be Microsoft hardware.  Go through the manufacturer (and it is possble the manufacturer will be * no * drivers for older operating systems supply - like XP.)

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

  • 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)
    
  • Impdp table parent key not found error

    I can't import a table into a database of 10.2.0.5 for 11.2.0.3 another. When I imported the first I get 1 error on creating a 1 constraint:

    Impdp tables of lego/password = estact directory = datapump dumpfile = estact.dmp

    Import: Version 11.2.0.3.0 - Production on Wed Apr 2 13:25:22 2014 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. Connected to: Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    With partitioning, Automatic Storage Management, OLAP, Data Mining

    and Real Application Testing options

    Table main "LEGO". "' SYS_IMPORT_TABLE_01 ' properly load/unloaded

    Departure "LEGO". ' SYS_IMPORT_TABLE_01 ': lego / * tables = directory = datapump dumpfile = estact.dmp estact.

    Object type TABLE_EXPORT/TABLE/TABLE processing object TABLE_EXPORT/TABLE/TABLE_DATA of treatment type

    . . imported "LEGO". "' ESTACT ' 56.01 MB 612972 lines

    Processing object type TABLE_EXPORT/TABLE/SCHOLARSHIP/OWNER_GRANT/OBJECT_GRANT

    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

    Object type TABLE_EXPORT/TABLE/CONSTRAINT/treatment

    Object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS of treatment

    Object type TABLE_EXPORT/TABLE/COMMENT of treatment

    Object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT of treatment

    ORA-39083: Type as ref_constraint cannot be created with the object error:

    ORA-02298: cannot validate (LEGO. EstOp_EstAct) - parent key not found

    Because sql is:

    ALTER TABLE 'LEGO '. "' ESTACT ' ADD 'EstOp_EstAct' of CONSTRAINT FOREIGN KEY ('ESTOP_ID')

    REFERENCES "LEGO". "" ESTOP "ENABLE ("ESTOP_ID")

    Object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS treatment

    Working "LEGO". "" SYS_IMPORT_TABLE_01 "completed with error (s 1) at 13:25:28

    Load data however this foreign key is not there then try to create manually after I get this error:

    "ORA-02298: unable to validate (LEGO." EstOp_EstAct) - parent key not found ".

    This source table has 3 foreign key constraints. The one that I'm having a problem setting (above) is a constraint against himself.

    I tried another approach. I exported and imported the metadata only and successfully completed. However when I then exported and imported DATA only, the data will not now with the same error:

    ORA-31693: Table object 'LEGO' data "' ESTACT ' failed to load/unload and being ignored because of the error:

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend

    ORA-02291: integrity constraint (LEGO. EstOp_EstAct) violated - key parent not found

    My question is what I have to do something different when you work with a table with a foreign key against himself constraint?

    Here's the DOF of the source table and 3 foreign keys:

    CREATE THE LEGO TABLE. ESTACT

    (

    ESTOP_ID NUMBER (10,0) NOT NULL,

    OPCLASS_CODE VARCHAR2 (10) NOT NULL,

    ESTACT_FLAG NUMBER (5.0) NOT NULL,

    COSTR_NO_EST NUMBER (5.0) NULL,

    ESTACT_TIME NUMBER (10,0) NULL,

    ESTACT_FIX_COST NUMBER (20.4) NOT NULL,

    ESTACT_VAR_COST NUMBER (20.4) NOT NULL,

    ESTACT_LAB_COST NUMBER (20.4) NOT NULL,

    ESTACT_OEX_COST NUMBER (20.4) NOT NULL,

    ESTACT_TOT_COST NUMBER (20.4) NOT NULL,

    ESTACT_PRI_COST NUMBER (20.4) NOT NULL,

    ESTACT_CM_PRICE NUMBER (20.4) NOT NULL,

    ESTACT_PRI_RATE NUMBER (20.4) NOT NULL,

    ESTACT_IS_PRICE NUMBER (5.0) NOT NULL,

    NUMBER OF ESTACT_BASE_QTY NULL,

    RULE_CODE_BASE_QTY VARCHAR2 (10) NULL,

    ESTACT_NUM_FORMS NUMBER (5.0) NULL,

    ESTACT_FIXMIN NUMBER (10,0) NULL,

    UNIT_CODE_BASE VARCHAR2 (10) NULL,

    UNIT_CODE_INPUT VARCHAR2 (10) NULL,

    ESTACT_AFLAG NUMBER (5.0) NOT NULL,

    NUMBER OF ESTACT_AOPRATE NULL,

    RULE_AOPRATE VARCHAR2 (10) NULL,

    NUMBER OF ESTACT_AWARATE NULL,

    RULE_AWARATE VARCHAR2 (10) NULL,

    NUMBER OF ESTACT_OPRATE NULL,

    NUMBER OF ESTACT_WARATE NULL,

    RULE_CODE_COSTR VARCHAR2 (10) NULL,

    RULE_VAL_COSTR NUMBER (5.0) NULL,

    RULE_CODE_FIXMIN VARCHAR2 (10) NULL,

    CONSTRAINT ESTACT_IDX0

    PRIMARY KEY (ESTOP_ID, OPCLASS_CODE)

    USING INDEX TABLESPACE INDEX

    PCTFREE 10

    INITRANS 2

    MAXTRANS 255

    STORAGE INITIAL (128K

    DEFAULT USER_TABLES)

    ENABLE

    VALIDATE

    )

    BUNCH OF ORGANIZATION

    TABLESPACE USERS

    LOGGING

    PCTFREE 10

    PCTUSED 0

    INITRANS 1

    MAXTRANS 255

    STORAGE (DEFAULT USER_TABLES)

    NOPARALLEL

    NOCACHE

    NOROWDEPENDENCIES

    This is the foreign key DDL. Note the 1 that refers to the same table (the one I'm having a problem with)

    ALTER TABLE LEGO. ESTACT

    ADD CONSTRAINT 'EstOp_EstAct '.

    FOREIGN KEY (ESTOP_ID)

    REFERENCES TO LEGO. ESTOP (ESTOP_ID)

    ENABLE

    VALIDATE

    /

    ALTER TABLE LEGO. ESTACT

    ADD CONSTRAINT 'RuleCodeCost_URULE '.

    FOREIGN KEY (RULE_CODE_COSTR)

    REFERENCES TO LEGO. URULE (URULE_CODE)

    ENABLE

    VALIDATE

    /

    ALTER TABLE LEGO. ESTACT

    ADD CONSTRAINT 'EstActURule_FixMin '.

    FOREIGN KEY (RULE_CODE_FIXMIN)

    REFERENCES TO LEGO. URULE (URULE_CODE)

    ENABLE

    VALIDATE

    /

    Post edited by: karine

    As Galo indicated Balda, your child table (LEGO. ESTACT) has a folder that does not exist in your table parent (LEGO. ESTOP) and this effect is impossible to create the foreign key.

    You can find the recordings by running:

    select estop_id from LEGO.ESTACT -- CHILD TABLE
    minus
    select estop_id from LEGO.ESTOP -- PARENT TABLE
    

    AFTER BACK YOU UP YOUR DATA, you need to create the new record in the parent table or remove the child table record in order to comply with the foreign key constraint.

  • Create table - foreign key

    Hi all.

    I started to create tables in SQL.

    My question is about the best way to refer to a column as a foreign key.

    Example:

    A simple way to make a primary key field.

    CREATE table emp (emp_id number (3.0) not null not the primary key)

    This will create emp_id as the primary key of the table emp.


    If there is another field, dept_no and this must be the foreign key.

    CREATE table emp (emp_id number (3.0) not null primary key, dept_no?)


    So my question is what is the most easy, less complicated way to make the dept_no field a foreign key to the emp table

    Thank you
    GtG

    Try like this...

    CREATE table emp (emp_id number (3.0) not null primary key, done dept_no refers to table_name (coluimn_name));

    -Clément

  • Tecra M10 - stuck - CTRL key question may be to do with the BIOS?

    Hello and thanks for reading.

    I recently changed my Tecra M10 to Windows 7 (from XP), and it quickly developed the dreaded question-button stuck CTRL This causes the keyboard behaves as if the CTRL key is pressed continuously. Sometimes reaching a key combination, or bring up the on-screen keyboard, temporarily solves the problem, but he returned.

    It seems to be a problem that many people have no simple solution. I watched each thread that I find and tried a lot of things to do with drivers etc without success.

    So first of all, if anyone knows a remedy that works for this particular machine, I would be very grateful to hear!

    Then, there are two things that I did not yet: updating the BIOS and turn off pinch zoom.

    I was watching the following BIOS update:

    http://www.Toshiba-Asia.com/SG/support/drivers/details/25244

    ... which is the version 3.00 and seem to be more recent. My version is 1.90.

    However, version 3.00 is labeled "for PTMB0 * ONLY. I don't know what that means or if it applies to me. Can anyone help? Should I install this BIOS?

    For the pinch zoom, I was informed that disable sometimes cures the problem CTRL - but I can't find any installation zoom pinch on the M10. I think he doesn't have any one. Is this fair?

    Thanks much for any help you can give.

    Hello

    > I was watching the next BIOS update. is the version 3.00, which seems to be most recent. My version is 1.90.

    There are different Tecra M10 models on the market.
    Check the labels at the bottom of the unit. There you should find numbers like for example PTMB0E-01K00LGR

    The first 6 characters are important: for example PTMB0E

    I guess that your laptop belongs to the series of Europeans.
    In this case, you should check the page of the Toshiba UE driver for a possible update of the BIOS.
    http://www.Toshiba.EU/innovation/download_drivers_bios.jsp

    However, on the page of the Toshiba UE driver you will also find the BIOS for all European units Tecra M10 v3.0.

    Anyway, back to Ctrl + button question: guess what, you need to connect an external USB keyboard and must check how is the CTRL key.
    In case the USB keyboard would work properly, the internal keyboard CTRL key is assigned and you will need to replace the internal keyboard.

    PS: it would be possible that the "sticky keys" option has been activated. To disable this feature, you must press SHIFT 5 times in the line.

  • Key question Qosmio X 770 - 107 - FN and tactile

    Toshiba Forum Dear members,

    I am writing this new thread because I have a serious problem with my Qosmio X 770 - 107.

    I bought it in 2014 of an electronics store famous here in Greece.
    The first problem was the little battery life. It has a duration of one hour when you surf on the internet and for about 10 to 30 minutes when playing games. I've changed lots of time settings but nothing has changed.
    Then I went to the store again once, where they found a problem with the battery and they changed it.

    However the same thing happening. Then I changed the battery 2 times as well as the laptop and the charge of cable during the year. The third model, I had the same problem. After a month I lived some problems with blue screens and the fn keys did not work.
    I formatted and the problem with blue screens has been fixed.

    Today, I always have the same laptop and the fn keys do not work. I tried reinstalling the drivers but nothing has changed. In addition, the touch button for the lighting of the keypad does not work and when I touch it the sound is muted.

    My question is if anyone has had the same problems or similar to ones I have and if I can do something to change this model with another or receive my refund.

    Here, I see that I sent emails many times to Toshiba, but they have not responded.
    I also sent my laptop Toshiba official service in Greece, but they do not solve my problems.

    Please answer as soon as possible

    Thanks in advance

    Kind regards
    Xenophon

    I formatted and the problem with blue screens has been fixed.

    BSOD problems are mainly related to software problems... Updated MS as well as conflicts between different applications can cause the BSOD... so its always advisable to get the device back to factory settings to get rid of system conflicts.

    Today, I always have the same laptop and the fn keys do not work. I tried reinstalling the drivers but nothing has changed. In addition, the touch button for the lighting of the keypad does not work and when I touch it the sound is muted.

    I guess that you always use the Windows 7 system.
    As I said, due to updates, it can happen that the system registry and the FN key utility would be confused to the top...

    The FN keys are controlled by Toshiba Value added Package as well as the Flash Cards Support utility
    That's why I recommend you to uninstall these two tools. Then restart the laptop. To clean the registry (you can use CCleaner utility). After that, restart the laptop once more and then start the installation of the package of added value and utility to Support Flash Cards

    In addition I recommend you check this interesting Toshiba document that explains all the software pre-installed on different Toshiba laptops:
    https://support.Toshiba.com/support/...tentId=3368363

    You can also check help utility of Toshiba... and Toshiba button support that allows to configure the touch buttons...

    You asked for the money back guarantee...
    Well, I've never read this laptop computer manufacturer could repay... in my opinion it should be cleared up with a dealer... but laptops are covered by the standard warranty one year and in case of hardware problems, the Toshiba ASP should fix the problems...

  • Key question product!

    I bought an original package of Windows 7 Ultimate and formatted my pc that several times but the last, I've said that my product key is incorrect, and he gave me options to choose. My question is why it has not agreed to this I called the automated telephone service?

    Probably because the Windows 7 Ultimate is an upgrade license.

    However, the requirements for the media upgrade is that you have an operating system already eligible such as Windows XP or Vista installed to use it. Since the Windows 7 end user license agreement.

    15 UPDATES. To use upgrade software, you must first be licensed for the software that is eligible for the upgrade. After the upgrade, this agreement takes the place of the agreement for the software that you upgraded. After upgrade, you can no longer use the software that you upgraded.

    Please run the Microsoft Genuine Diagnostics Tool then copy and paste the results into an answer here for further analysis:
    http://go.Microsoft.com/fwlink/?LinkId=52012

  • Windows Server 2012 Essentials license key questions

    We recently had to reinstall a server running Windows Server 2012 Essentials.

    We have reinstalled the wrench out of the key Windows Server 2012 Essentials on Tower Server. This key worked for a few days. Then the server started to complain that the key cannot be used. When I enter the key in the key of Activation Windows field, a label in this text field indicates the key is valid, but when I click on the button Activate, after half a minute to process the application, it gives a 0xC004F01F error.

    We appreciate any help you can give on this.

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • Table tree select questions

    Hi all

    I use Jdeveloper 12.1.2.0.0.

    My requirement is to select the checkbox all rows in a table from the tree root level when the user clicks a checkbox control named selectAll (this box resides outside the TreeTable). If the user disables the selectAll checkbox all rootLevel in tree lines must be unchecked.

    The tree has two levels. I used a transitional mode attribute in the t and when the user clicks the selectall checkbox, ValueChange Listener fires and I'm looping through the lines of the iterator, setting the transient value to be true.

    It works fine all the time but not the first time. When I click on the for the first time selectAll checkbox, the ValueChange listener fires but the treeTable lines are not get verified. The second time, it works perfectly.

    I have a partial trigger to the TreeTable.

    If I use a button instead of a check, it works fine all the time.

    Could someone help me.

    Do not know what causes this. Have you tried in jdev 12.1.3?

    To work around the problem, you can but a button hidden on the page and the queue an event to actin the listener to change value of the check box for the button. So easy the key dies at work, and it should work.

    Timo

  • How to fill out the table foreign key to the primary key form

    Hi all

    I'm stuck in this problem for 3 days, and I'm about to research and implement solutions on the internet.

    I have two tables

    create table prim (a number primary key, b varchar2 (100));

    create table CHILD (a number references (a) prim, varchar2 (100)) c;

    I created a page for PRIM table.

    = page name form on PRIM2

    I have manually two columns for the CHILD table to know

    P26_A_1 (for the primary key in the CHILD table)

    P26_C (for the column in the CHILD Table c)

    now when the user clicks on the button CREATE, a row must be inserted into the child table.

    I want to assign the P26_A to P26_A_1 during the validation process, so that a line must be inserted into the PRIM table as well as in the CHILD table.

    How to do this?

    I downloaded my application page in https://apex.oracle.com

    my workspace identifiers are inferior to

    name of the workspace = IMBERT

    username = demo

    password = demo

    kindly guide me.

    Thank you.

    Hello

    I created a new page (page 30) similar to your page and added the insertion of the child. It just check the page and code. It works now, when you insert the prim file is triggered a second trial which inserts the child record manually.

    On page 26 it was some sort of mistake, was easier to create a new as it was almost a standard form.

    Concerning

    Bottom

Maybe you are looking for