Note
This variable was introduced in V2.2.30.
Description
The nls_timestamp_format variable controls the format for converting timestamps or timestamps with time zones to strings, and for implicitly converting strings to timestamps or timestamps with time zones.
Applicability
This variable applies only to OceanBase Database in Oracle mode.
Privilege requirements
Query variables
Global level
Users in the
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle mode) to view the value of a global system variable.Session level
Users in the
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (Oracle mode) to view the value of a session system variable.
Modify variables
Set the variable at the global level
Users in the
systenant can directly modify the value of a global system variable.Users in an Oracle user tenant must have the
ALTER SYSTEMprivilege to modify the value of a global system variable.
Set the variable at the session level
Users in the
systenant and all user tenants can directly modify the value of a session system variable in their own tenant.
Attributes
| Attribute | Description |
|---|---|
| Type | Varchar |
| Default value | DD-MON-RR HH.MI.SSXFF AM |
| Scope | |
| Modifiable | Yes. The value can be modified by using the SET statement. |
Considerations
The variable specifies the default date format to be used by the TO_CHAR and TO_TIMESTAMP functions. The default value is YYYY-MM-DD HH24:MI:SS.FF.
Examples
Set the variable at the session level
obclient> SET nls_timestamp_format='YYYY-MM-DD HH24:MI:SS.FF';Set the variable at the global level
obclient> SET GLOBAL nls_timestamp_format='YYYY-MM-DD HH24:MI:SS.FF';