Hi,
I have the following query:
_SELECT (CANONICAL\_NAME || ', ' || ALIASES || ' (' || DESCRIPTION || ')' ) D, ID R FROM WP\_ENCODING_
This is used for a list of values in Oracle APEX. Examples of the output for value D are:

When column ALIASES is null or '', I would like to have the following SQL query instead:
_SELECT (CANONICAL\_NAME || ' (' || DESCRIPTION || ')' ) D, ID R FROM WP\_ENCODING_
So basicaly I would like to remove this:
', ' || ALIASES ||
when ALIASES is null or ''.
Which would be the way to achieve this in SQL? If doing directly in SQL is not possible, how could I write a PL/SQL function body returning a SQL query which is what Oracle APEX can use as List of Value?
I am using Oracle 18c XE in case it is relevant.
Thanks,