description |
---|
Converts the input expression to a character/string using the specified format. |
- expression: Expression to convert to a string.
- format: Format to use for the conversion.
Examples
{% code title="TO_CHAR example" %}
SELECT TO_CHAR(CAST('01:02:03' AS TIME) , 'HH:MI');
-- 01:02
{% endcode %}
- expression: Expression to convert to a string.
- format: Format to use for the conversion.
Examples
{% code title="TO_CHAR example" %}
SELECT TO_CHAR(CAST('2021-02-11' AS DATE) , 'yyyy.mm.dd');
-- 2021.02.11
{% endcode %}
- expression: Expression to convert to a string.
- format: Format to use for the conversion.
Examples
{% code title="TO_CHAR example" %}
SELECT TO_CHAR(10, '#')
-- 10
{% endcode %}
- expression: Expression to convert to a string.
- format: Format to use for the conversion.
Examples
{% code title="TO_CHAR example" %}
SELECT TO_CHAR(7.5, '#.#')
-- 7.5
{% endcode %}
- expression: Expression to convert to a string.
- format: Format to use for the conversion.
Examples
{% code title="TO_CHAR example" %}
SELECT TO_CHAR(10, '#')
-- 10
{% endcode %}
- expression: Expression to convert to a string.
- format: Format to use for the conversion.
Examples
{% code title="TO_CHAR example" %}
SELECT TO_CHAR(7.5, '#.#')
-- 7.5
{% endcode %}
- expression: Expression to convert to a string.
- format: Format to use for the conversion.
Examples
{% code title="TO_CHAR example" %}
SELECT TO_CHAR(CAST('2013-04-05 01:02:03' AS TIMESTAMP) , 'mm/dd/yyyy, hh:mi');
-- 04/05/2013, 01:02
{% endcode %}