Overview
The last_insert_id is used to update the value of the auto-increment field for the last insert by the current session.
Privilege requirements
Query variables
Both the
systenant and all user tenants can use theSHOW VARIABLESstatement and theinformation_schema.SESSION_VARIABLESview to view the values of session system variables.Modify variables
The
systenant and all user tenants can directly modify the values of session system variables for their own tenants.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Unit |
| Default Value | 0 |
| Value range | [0, 18446744073709551615] |
| Effective Scope | Session |
| Modifiable | Yes, you can use theSETStatement modification. |
Configuration example
Update the auto-increment field value to 1001 for the last inserted record.
obclient> SET last_insert_id= 1001;