It is impossible to enter data in such a way that they get into the variable when trying to enter the error ORA-02291: integrity constraint (YOZHIK.Oblad_fk2) violated - parent key not found into the table ORA-02291: integrity constraint (YOZHIK.Oblad_fk2) violated - parent key not found If you enter the value manually from selects, everything goes smoothly.

 DECLARE Count_Tip number; Count_Firm number; Count_Model number; BEGIN SELECT Max(ID) into Count_Tip FROM "Tip" ; SELECT Max(ID) into Count_Firm FROM "Firm" ; SELECT Max(ID) into Count_Model FROM "Model"; insert into "Oblad"("ID_Tip","ID_Firm","ID_Model","Polomka") Values ( Count_Tip, Count_Model, Count_Firm, 'test4' ); END; 
  • You insert into the fields, in order: "ID_Tip", "ID_Firm", "ID_Model", And the variables are set in a different order: Count_Tip, Count_Model, Count_Firm - Mike
  • And by the way, variables and procedure are not needed here. insert into ... select (select max(id) from tip), (select max()...), (select ...), 'test4' from DUAL will do fine - Mike
  • Indeed, that's it), thanks. The procedure is needed, I just simplified it, I enter the data in 3 tables (type, model, company) and through the procedure I go to Oblad. Thank you, and I knew that I missed something because of inattention - Andriy Petruk
  • And where does your ID come from there, select max (id) is not quite safe, it may not be what you inserted. Usually, sequences are used when inserting, it is worth taking currVal from them after insertion - Mike
  • The ID is inserted into the tables by the sequence sequencer BI; therefore, when inserting a new value into the table, it will have the maximum ID. - Andriy Petruk

0