Summary: in this tutorial, you will learn how to use the Oracle Show The Oracle For the demonstration the functionality of the Basic usage of Oracle LISTAGG() functionSometimes, you may want to aggregate data from a number of rows into a single row and associate the result row with a specific value. For example, the following query returns a comma-separated list of employees for each job title.
In this example, the The following illustrates the syntax of the Oracle
In this syntax:
For example, the following query retrieves a list of order ids with their corresponding products in the comma-separated values format:
Oracle LISTAGG(): return an error on overflowIf the result row exceeds the maximum length of the supported data type, you can either return an error or truncate the result row and concatenate a truncation literal. The following shows the syntax:
Note that the For example, the following statement retrieves product categories (
Oracle issued the following error because the result string is too long:
Oracle LISTAGG(): truncate result on overflowSince Oracle 12c Release 2, you can use the
By default, The following example shows the category id list and their corresponding product descriptions which are truncated:
If you don’t want to use the default ellipsis, you can specify a
custom truncation literal by defining it after the
To remove the overflow character count, you use the
In this tutorial, you have learned how to use the Oracle
Was this tutorial helpful? |