Patent ID: 7373357

Claim:
A method comprising: selecting a set of instances from a set of data; determining a number of related records in a set of related records of a table, wherein each record of the set of related records is related to one instance of the set of instances; comparing the number of related records and a number of instances in the set of instances prior to generating a set of select statements to select the set of related records from the table; and if the comparing indicates that the number of instances is greater than the number of related records, generating the set of select statements to comprise one select statement to select the set of related records from the table, wherein the one select statement includes a clause to select a corresponding record for each instance of a set comprising a maximum number of instances of the set of instances, the maximum number of instances is determined by a maximum number of clauses in the one select statement, and the one select statement is configured to cause an update operation to be performed on a record in the table, if the record already exists in the table, and cause an insert operation to be performed to insert the record in the table, if the record does not already exist in the table.