Note
This variable is available starting with V1.4.
Description
last_insert_id specifies the value of the last auto-increment field inserted in the current session.
Privilege requirements
Query variables
systenants and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (Oracle mode) or theinformation_schema.SESSION_VARIABLESview (MySQL mode) to view the value of a session system variable.Modify variables
systenants and all user tenants can directly modify the value of a session system variable of their own tenant.
Attributes
| Attribute | Description |
|---|---|
| Type | Unit |
| Default value | 0 |
| Value range | [0, 18446744073709551615] |
| Scope | Session |
| Modifiable | Yes. You can execute the SET statement to modify the value. |
Examples
Update the value of the last auto-increment field inserted to 1001.
obclient> SET last_insert_id= 1001;