Hello,
I have the following database structure
Table1(field1, field2, field3)
field1 is of type NUMBER(15,2) in Oracle8i and is primary key
Table2(field4,field5)
field4 is of type NUMBER(15,2) in Oracle8i and is a foreign key with references to Table1.field1
I am trying to populate both the tables using
JDBC. I am able to successfully populate Table1 but when I populate Table2, I get an exception which says "Integrity Constraint violated-parent key not found", which means the matching value of foreign key is not found in Table1. This is strange because once I populate table1, I retrieve the value of field1 by select command and store it in "double" variable. I pass the same variable in Prepared Statement where I say
pstmt.setDouble(1, variableName).
I have tried that using BigDecimal, Float, Long but no luck. Can someone tell me what is the correct datatype I should store it in? Or anyother suggestion to approach this problem.
A code snippet would definitely help.
Thanks in advance.