Note
This variable is available starting with V1.4.
Description
identity and the last_insert_id variable are synonyms. You can execute the select @@identity statement to query the value of the variable.
Privilege requirements
Query variables
The
systenant 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 obtain the values of session system variables.Modify variables
The
systenant and all user tenants can directly modify the values of session system variables in their own tenants.
Attributes
| Attribute | Description |
|---|---|
| Type | Uint |
| 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 inserted auto-increment field to 1001.
obclient> SET identity= 1001;