Purpose
You can call this function to convert a string into a TIMESTAMP value.
Syntax
TO_TIMESTAMP (char,[fmt],['nlsparam'])
Parameters
| Parameter | Description |
|---|---|
| char | An expression of the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type. |
| fmt | (Optional) Specifies the format of char. If fmt is omitted, char must use the default format of the TIMESTAMP data type. |
| nlsparam | (Optional) Specifies the language used for the month and day returned. |
Return types
This function returns the TIMESTAMP data type.
Examples
Convert the string 2021-11-11 11:11:11.11 to a timestamp.
obclient> SELECT TO_TIMESTAMP ('2021-11-11 11:11:11.11', 'YYYY-MM-DD HH24:MI:SS.FF')
FROM DUAL;
+-----------------------------------------------------------------+
TO_TIMESTAMP('2021-11-1111:11:11.11','YYYY-MM-DDHH24:MI:SS.FF')
+-----------------------------------------------------------------+
11-NOV-21 11.11.11.110000000 AM
+-----------------------------------------------------------------+
1 row in set