Ruben12345 says:
When i have insert new record with same vehicle_id then end_date_time with contain empty/null (from first step) must be inserted value from begin_date_time at second step
so you want to say that when you have inserted one record with end_date = null and vehicle id something and while inserting new record you want to check whether any record exists in ship table with inserting vehicle id if vehicle id exists then you want to insert the end time same as begin time ?