An Error Had occurred while accessing the database ORA-02291: integrity constraint (TRANS_R_LEAVE_FK1) violated - parent key not found
Matthew Brown wrote:If you aren't trying to insert anything, what is the "insert into TRANS(...)" statement for?
Megha Singhal wrote:no but i am inserting in the TRANS and the problem is coming in R_LEAVE which is showing that i am trying insert something in the R_LEAVE
Martin Vajsar wrote:
Megha Singhal wrote:no but i am inserting in the TRANS and the problem is coming in R_LEAVE which is showing that i am trying insert something in the R_LEAVE
No.
It is saying that the value you're trying to insert into the column LEV_TYPE in table TRANS is not one of these defined in table R_LEAVE.
Martin Vajsar wrote:Post more of your code then. The value for the LEV_TYPE column has got mangled somewhere on its way in.
You should learn to use PerparedStatement. You might start with a good tutorial. There are several reasons to do so, including security, performance and correctness of your code, as described here.
Martin Vajsar wrote:Well, if all was done as you have described it, then it would work. Since it doesn't, there is probably a bug somewhere in your code; if you cannot post the code (which I understand), we cannot help you spot the bug directly.
In this case, you can either debug your code using a debugger, or try to output values of key variables into a log so that you see what is happening to the variable which you're then inserting into the TRANS.LEV_TYPE column. You could even write the complete SQL statement you've constructed to a log (since you're not using PreparedStatement, but that is actually a bad thing too as I've already mentioned).