Insert values in child table
Hi all,In my first.jsp iam inserting values to the master table and in the second.jsp i am inserting values to the child table..My issue is how to get the auto-incremented value of the master table for inserting in child table?
[248 byte] By [
a1ba] at [2007-11-27 4:44:54]

# 1
You're talking about JDBC + SQL? If so, for most databases you can use (Prepared)Statement#getGeneratedKeys(). For certain databases, like PostgreSQL and Oracle, you have to write a specific query to retrieve the current sequence.
# 3
You have to define the column as auto_increment in the DDL. Then, after the Insert query, you can use getGeneratedKeys() of the same Statement or PreparedStatement to retrieve the last insert ID.