Integrity constraint

Integrity constraint

  

Hi all, 

  I was trying to insert into table with foreign key but get the constraint error messages. 


I did the same with other form with success. But dont know what is the diference, 


I debug It but cant find it.


Thanks,

Tomás

Hi Tomás,

The error happens when, in the record that you are creating (or updating), you have a mandatory attribute that is an identifier to some other entity and the value for that attribute does not have a matching value in the other entity.

Check that for all attributes that are identifiers, when you are doing the create, they have a matching record in the corresponding entity.

Cheers,

José

     Of course, this is the mistake. But I am usign the same method (CreateAPM_Jubilados.Id) in both diagrams to get the last Id (primary key) inserted. In the firts I can insert in the foreign key table.


Thanks

Aren't you forgetting to do an Assign before the Create?

You should debug the code and make sure the right data is there before calling the method.

I swear I did the assign, and debug. The next image is the evidence:



But always I get the constraint message.


Thanks guys

Do you do a create or a CreateOrUpdate?

Solution

Do you have a DB. Give him the name of the constraint and he can see what the constraint is exactly about.

Solution

I create and the constraint is: ORA-02291: integrity constraint (OSADMIN_OSDEV1.OSFRK_OSUSR_LYT_APMJ_BE1_88080) violated - parent key not foundORA-06512: at line 1


Thanks


I agree with José. There is a manditory field which is not specified.
Your db should tell you which field this is whenyou give him the constraint name on the table.