https://www.databasestar.com/oracle-to_char/
The Oracle TO_CHAR function is a common and useful string manipulation function. It allows you to convert a number or a date value into a string value.
It allows you to take a number or a string, and convert it to a VARCHAR2 data type.
The syntax of the function is:
TO_CHAR( input_value, [format_mask], [nls_parameter] )
The parameters are:
- input_value: this is the value to convert to a VARCHAR2 value. It can be one of many different number or date data types.
- format_mask is an optional parameter and allows you to specify the format to display the output as. If this is omitted, the function uses a default format.
- nls_parameter: this is also optional and lets you determine a regional parameter for displaying the output value.
The format mask helps you determine what your output is displayed as. For example, if you provide the date of May 3rd, and the output is โ03/05/2018โ, how do you know if this is May 3rd or March 5th? Using a format mask can specify which format is used.
The function is similar to the TO_NUMBER and TO_DATE functions, in that they both convert a specific data type.
For more information about the Oracle TO_CHAR function, including all of the SQL shown in this video and the examples, read the related article here:
https://www.databasestar.com/oracle-to_char/
/// RESOURCES
๐ Get my free SQL Cheat Sheets: https://www.databasestar.com/get-sql-cheat-sheets/
๐งญ SQL Roadmap from basics to advanced: https://www.databasestar.com/sql-roadmap/
โ๏ธ Learn how to design a database: https://databasestar.mykajabi.com/edd
๐ Improve your SQL and database skills with Database Star Academy: https://www.databasestar.com/dsa/
๐ง Contact me here: https://www.databasestar.com/contact/
๐ Database Design Exercises: https://bbrumm.gumroad.com/l/hqsxi
๐ SQL Practice Questions: https://bbrumm.gumroad.com/l/ulekqk
๐ SQL Performance Quick Guide: https://bbrumm.gumroad.com/l/fcvny
๐ Ultimate SQL How-To Guide: https://bbrumm.gumroad.com/l/oqggau
17 Comments