PostgreSQL - CHR Function Last Updated : 26 Jul, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The CHR() function in PostgreSQL is used to convert an integer ASCII code or a Unicode code point into its corresponding character. Let us better understand the concept of CHR Function in PostgreSQL from this article.SyntaxCHR(value);Parameter:value: The 'value' argument is generally an integer ASCII code or a UTF8 Unicode code point character.The CHR() function is often used to retrieve the character associated with a given ASCII code or Unicode code point. This can be particularly useful for generating specific characters dynamically or for processing data that involves character codes.PostgreSQL CHR Function ExamplesLet us look at some of the examples of CHR Function in PostgreSQL to better understand the concept.Example 1: Converting ASCII Codes to CharactersThe following statement shows how to use the CHR() function to get the characters whose ASCII code value is 100 and 200:SELECT CHR(100), CHR(200);Output:Explanation: In this example, CHR(100) returns the character 'd', which corresponds to the ASCII code 100. CHR(200) returns a character based on the extended ASCII table, which might vary depending on the system's character set encoding.Example 2: Converting Additional ASCII Codes to CharactersThe following statement shows how to use the CHR() function to get the characters whose ASCII code value is 52 and 87:SELECT CHR(52), CHR(87);Output:Explanation: In this query, CHR(52) returns the character '4', and CHR(87) returns the character 'W', corresponding to their respective ASCII codes.Important Points About PostgreSQL CHR FunctionThe CHR() function supports Unicode code points, allowing you to convert integers representing Unicode characters to their respective UTF8 characters.PostgreSQL CHR() function can handle extended ASCII values (128-255) based on the system's encoding. The CHR() function can generate control characters (ASCII values 0-31). These characters are often non-printable and used for control purposes in data streams.You can use the CHR() function in combination with the ASCII() function to perform round-trip conversions between characters and their ASCII codes. Comment More infoAdvertise with us Next Article PostgreSQL - MD5() Function R RajuKumar19 Follow Improve Article Tags : PostgreSQL PostgreSQL-function PostgreSQL-String-function Similar Reads PostgreSQL - ASCII Function When working with PostgreSQL, you might need to derive the ASCII (American Standard Code for Information Interchange) code of a character. The PostgreSQL ASCII() function is a handy tool for this purpose. In the case of UTF-8 encoding, the ASCII() function returns the Unicode code point of the chara 2 min read PostgreSQL - FORMAT Function The PostgreSQL format() function is a powerful tool for string formatting by allowing developers to insert variables into strings using format specifiers like %s, %I, and %L. This function is especially useful for building dynamic SQL queries and ensuring proper formatting of identifiers. It simplif 3 min read PostgreSQL - MD5() Function The PostgreSQL MD5() function is a useful tool for evaluating the MD5 hash of a given string and returning the result in hexadecimal form. This function is often used for data integrity checks and secure password storage. Let's look into the syntax, and usage of the MD5() function in PostgreSQL with 2 min read PostgreSQL Date Functions PostgreSQL is widely recognized for its comprehensive support for date and time manipulations, making it an excellent choice for applications requiring precise time management and complex calculations. This article explores the core PostgreSQL date functions, covering how to retrieve the current dat 4 min read PostgreSQL - NOW() Function The NOW() function in PostgreSQL is a powerful and essential tool for retrieving the current date and time. This is particularly useful when recording actions like adding or updating records in our database. Using PostgreSQL NOW() function, we can efficiently track when events occur, making the data 4 min read PostgreSQL - CONCAT_WS Function In PostgreSQL, the CONCAT_WS function is a powerful and versatile tool for concatenating strings with a specified separator. This function not only combines multiple string values but also efficiently handles NULL values, ignoring them in the concatenation process. In this article, we will go deep i 3 min read Like