Recently, I encountered a problem when writing a stored procedure. I always encountered an error when using batch data insertion. It was said that the uniqueness constraint was violated. Finally, I checked the stored procedure and found that the typetable data was not deleted.
Recently, I encountered a problem when writing a stored procedure. I always encountered an error when using batch data insertion. It was said that the uniqueness constraint was violated. Finally, I checked the stored procedure and found that the type table data was not deleted.
Recently, I encountered a problem when writing a stored procedure. I always encountered an error when using batch data insertion. It said that the uniqueness constraint was violated. Finally, I checked the stored procedure and found that the type table data was not deleted, the stored procedure is as follows:
V_card_id (I) in the query is found. If the number of bt_row.confirm_quanlity queried is the same, the data should be reinitialized. If the number is different, for example, the number of the previous query is large, the number of the next time is small. If v_card_id is not initialized, duplicate results may appear. All temporary tables must be cleared in each loop.
After checking the relevant information, you only need to useV_card_id.deleteDelete the temporary table.
Modify as follows: