DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: integrity constraint (SYS.SYS_C001956) violated - parent key not found

  1. #1
    Join Date
    Nov 2004
    Posts
    3

    integrity constraint (SYS.SYS_C001956) violated - parent key not found

    Hey everyone,

    I'm trying to put some values into this table:

    create table Login
    (
    UserName varchar (16) primary key,
    user_password varchar (16),
    customerID char(10) not null,
    foreign key (customerID) references Customer(customerID)
    );


    for example:

    insert into Login values ( 'bobbybob', '123456', 'bob123456');

    and it's giving me this error:

    integrity constraint (SYS.SYS_C001956) violated - parent key not found

    Does anyone know why?

    Thanks in advance,
    Joel

  2. #2
    Join Date
    May 2002
    Posts
    2,645
    Does that customerID exist in the customer table? Also, it helps to explicitly name constraints. You won't have to guess (or dig out of the data dictionary) what "sys.sys_c001956" is referring to. Are you using one of the more than 400,000 hits Google hits for "Oracle constraints?" Name of a book? Links to Oracle documentation?

  3. #3
    Join Date
    Feb 2003
    Posts
    40
    Hai,
    Since login is child table which references the master table (Customer) .You have to insert the corresponding record in the master table (customer table) first and then in the child table(login table)

    Since you have info about the child and master tables already ,you need not check data dic .

    In situations where this constraint error occurs and you don't have a clue as which is the master table then you can use the query

    select m.table_name master,c.table_name child
    from user_constraints m,
    user_constraints c
    where m.constraint_name=c.r_constraint_name
    and c.r_constraint_name='';

    In your situation c.constraint_name='SYS_C001956';
    K.Chithra
    Oracle DBA

Posting Permissions

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


Click Here to Expand Forum to Full Width