The CONVERT function converts a value in Oracle from one data type to another, and its syntax is CONVERT(
, ). It can be used to convert string to number, number to string, date to string, string to date, binary to string and string to binary.
Usage of CONVERT function in Oracle
The CONVERT function is used in Oracle to convert data types. It converts a value from one data type to another.
Syntax
<code>CONVERT(<结果数据类型>, <输入值>)</code>
Parameters
Usage
The CONVERT function can be used to convert various data types, including:Example
Convert string to number:<code>SELECT CONVERT(NUMBER, '123.45') FROM DUAL;</code>
<code>SELECT CONVERT(VARCHAR2(20), 12345) FROM DUAL;</code>
<code>SELECT CONVERT(CHAR(10), SYSDATE, 'YYYY-MM-DD') FROM DUAL;</code>
<code>SELECT CONVERT(DATE, '2023-03-08', 'YYYY-MM-DD') FROM DUAL;</code>
<code>SELECT CONVERT(VARCHAR2(100), DUMP(NULL, 16)) FROM DUAL;</code>
<code>SELECT CONVERT(BLOB, 'This is a string.') FROM DUAL;</code>
Notes
The above is the detailed content of How to use convert function in oracle. For more information, please follow other related articles on the PHP Chinese website!