executemanyprepared(list_of_parameters) Method

Executes a previously prepared database operation in a batch format.

Syntax

cursor.executemanyprepared(<list_of_parameters>)

Parameters

Recommended Type Name Description
Tuple of Tuple <list_of_parameters>

Specifies the parameters for the previously prepared operation.

Returns

Returns a tuple of the rows affected counts corresponding to the results of the execution with each set of parameters.

Remarks

Raises an exception if cursor.prepare() has not been called or if another query has been executed on the cursor since the last prepare.

Example

The following example creates a new cursor with a prepared operation:

sql = 'INSERT INTO T2 (ID, C2) VALUES (?, ?)'
cursor = conn.cursor()
cursor2 = cursor.prepare(sql, newcursor=True)
cursor2.executemanyprepared([(1, 'hello'), (2, 'hello again'), (3, 'goodbye')])