Abhinav is correct, you probably do need a stored procedure - the alternative is to use a
Transaction[
^], where the data is not entered fully in either table until the transaction is complete, and can be rolled back if there is a problem. This would leave your database integrity ok.