executeprepared([parameters]) Method

Executes a previously prepared database operation.

Syntax

cursor.executeprepared([<parameters>])

Parameters

Recommended Type Name Description
Tuple of Tuple <parameters>

Specifies the parameters for the previously prepared operation.

Returns

Returned values are not defined.

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.

Unlike the cursor.execute() method, parameters cannot be specified with keywords.

Example

The following example prepares an operation on an existing cursor:

sql = 'CREATE TABLE T2 (ID INTEGER PRIMARY KEY, C2 VARCHAR(255))'
cursor = conn.cursor()
cursor.prepare(sql)
cursor.executeprepared()