Oracle COMPOSE() Function

Oracle COMPOSE() is a built-in function that returns the result of applying Unicode normalization (as described in Unicode Standard Definition D117) to the given string parameter.

Oracle COMPOSE() Syntax

Here is the syntax for the Oracle COMPOSE() function:

COMPOSE(str)

Parameters

str

Required. It can be one of the following data types: CHAR, VARCHAR2, NCHAR, or NVARCHAR2.

Return Value

The Oracle COMPOSE() function returns the result of applying Unicode normalization (as described in Unicode Standard Definition D117) to the given string parameter.

If the character set of the argument is not one of the Unicode character sets, then COMPOSE() returns the argument directly.

If any of the arguments is NULL, COMPOSE() returns NULL.

Oracle COMPOSE() Examples

Here are some examples that demonstrate the usage of the Oracle COMPOSE() function.

Basic Usage

SELECT
    COMPOSE('o' || UNISTR('\0308'))
FROM dual;

输出:

COMPOSE('O'||UNISTR('\0308'))
________________________________
ö

This example uses the UNISTR() function to return a Unicode string.

Here’s another example:

SELECT
    COMPOSE('a' || UNISTR('\0303'))
FROM dual;

输出:

COMPOSE('A'||UNISTR('\0303'))
________________________________
ã

NULL Parameters

If any of the parameters is NULL, COMPOSE() returns NULL.

SET NULL 'NULL';
SELECT
    COMPOSE(NULL)
FROM dual;

输出:

COMPOSE(NULL)
________________
NULL

In this example, we use the SET NULL 'NULL'; statement to display the NULL value as the string 'NULL'.

Conclusion

The Oracle COMPOSE() function is a built-in function that returns the result of applying Unicode normalization (as described in Unicode Standard Definition D117) to the given string parameter.