I ran into a requirement today where I had to combine a number of strings (varchars) into a delimited list. Some strings would be NULL and should be ignored.
I played around and found a bunch of different approaches which I’d like to share.
Let’s assume we have a package
info_util with the function
person which will combine a number of information about a person to a delimited list (to simplify the example all information is passed by parameter):
dbms_output.put_line(info_util.person( i_name => 'Luke Skywalker', i_alignment => 'light', i_comment => 'Most powerful jedi of all times')); -- Output: Luke Skywalker, light, Most powerful jedi of all times dbms_output.put_line(info_util.person( i_name => 'Vader', i_title => 'Darth', i_alignment => 'dark', i_comment => 'Pretty evil')); -- Output: Vader, Darth, dark, Pretty evilContinue reading