Database.insert() gives partial success results. When using this if any error occurs, the remaining records will be inserted/updated.
Syntax: Database.insert(recordsToinsert, allOrNone)
allOrNone is optional parameter which specifies the partial success of operation.