Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    55

    Unanswered: ORA-02291: integrity constraint (FRWKADMIN.FK_COMPONENT_PARAMETER)

    Hi,
    When I run the insert command .
    INSERT INTO BS_COMPONENT_PARAMETER (N_COMP_ID, C_PARAM_GROUP, C_PARAM_NAME, C_PARAM_VALUE) VALUES ('7','CHANNEL','RETRY_NUMBER','0');

    I get below error after commit ;
    SQL> commit;
    commit
    *
    ERROR at line 1:
    ORA-02091: transaction rolled back
    ORA-02291: integrity constraint (FRWKADMIN.FK_COMPONENT_PARAMETER) violated -
    parent key not found

    What is wrong in my command and table and index ??
    How I can find out which index is the table link ???
    How to fix the error ??
    I do not know much about table structure .Please advice .

    SQL> desc BS_COMPONENT_PARAMETER;
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    N_COMP_ID NOT NULL NUMBER(10)
    C_PARAM_GROUP NOT NULL VARCHAR2(40)
    C_PARAM_NAME NOT NULL VARCHAR2(40)
    C_PARAM_VALUE VARCHAR2(512)


    SQL> select * from tab;

    TNAME TABTYPE CLUSTERID
    ------------------------------ ------- ----------
    BS_ACCOUNT TABLE
    BS_ACCOUNT_PROFILE TABLE
    BS_AUDIT_TRAIL TABLE
    BS_AUDIT_TRAIL_ACTION TABLE
    BS_AUDIT_TRAIL_FUNCTION TABLE
    BS_AUDIT_TRAIL_OBJ_TYPE TABLE
    BS_AUDIT_TRAIL_VIEW VIEW
    BS_COMPONENT TABLE
    BS_COMPONENT_PARAMETER TABLE
    BS_ERROR_CODE_VIEW VIEW
    BS_INVOCATION TABLE

    TNAME TABTYPE CLUSTERID
    ------------------------------ ------- ----------
    BS_PRODUCT_CONFIG_DATA TABLE
    BS_PRODUCT_DOMAIN TABLE
    BS_PRODUCT_ERROR TABLE
    BS_PRODUCT_TYPE TABLE
    BS_PROFILE_DATA TABLE
    BS_PROFILE_RIGHT TABLE
    BS_SYSTEM_CONFIG_DATA TABLE
    CI_DELIVERY TABLE
    CI_MESSAGE TABLE
    FRWK_VERSION_LEVEL TABLE
    INSTALL_PRD_PARAM TABLE

    22 rows selected.

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Foreign key constraint has probably been defined as deferrable. In that case, it is possible to enter a value whose parent key does not exist, as long as you do not try to commit changes you've made.

    Here's an example: first, create two tables. Note the way foreign key was created in the "child" table.
    Code:
    SQL> create table t_parent
      2    (id number primary key,
      3     loc varchar2(20)
      4    );
    
    Table created.
    
    SQL> create table t_child
      2    (id number constraint fk_ch_par
      3     references t_parent (id)
      4     initially deferred deferrable,
      5     amount number
      6    );
    
    Table created.
    Now let's insert a record into a "child" table - everything seems to be OK (although it would fail IMMEDIATELY if it was an "ordinary" foreign key constraint):
    Code:
    SQL> insert into t_child (id, amount) values (2, 1000);
    
    1 row created.
    Finally, COMMIT:
    Code:
    SQL> commit;
    commit
    *
    ERROR at line 1:
    ORA-02091: transaction rolled back
    ORA-02291: integrity constraint (SCOTT.FK_CH_PAR) violated - parent key not found
    
    
    SQL>
    It has failed, as expected.

    Now, what do you want to do? Obviously, it is impossible to store a value which violates referential integrity constraint. If you don't need it, drop the constraint. Otherwise, make sure to insert only valid values before commit.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •