Creating Comma Seperated Lists
From TekiWiki
This whole wiki has now moved to http://www.springboardsolutions.com/wiki
Go to this page Creating Comma Seperated Lists
(Created page with "Creating a comma separated list from a table can be done by using the tree function sys_connect_by_path - this example creates a list of the columns in each table or view: selec...") |
|||
| Line 1: | Line 1: | ||
Creating a comma separated list from a table can be done by using the tree function sys_connect_by_path - this example creates a list of the columns in each table or view: | Creating a comma separated list from a table can be done by using the tree function sys_connect_by_path - this example creates a list of the columns in each table or view: | ||
| - | + | <pre> | |
select owner,table_name,max(ltrim(sys_connect_by_path(column_name,','),',')) Columns | select owner,table_name,max(ltrim(sys_connect_by_path(column_name,','),',')) Columns | ||
from ( | from ( | ||
| Line 12: | Line 12: | ||
group by owner,table_name | group by owner,table_name | ||
order by owner,table_name | order by owner,table_name | ||
| - | + | </pre> | |
...and this one puts them in alphabetical order: | ...and this one puts them in alphabetical order: | ||
| - | + | <pre> | |
select owner,table_name,max(ltrim(sys_connect_by_path(column_name,','),',')) Columns | select owner,table_name,max(ltrim(sys_connect_by_path(column_name,','),',')) Columns | ||
from ( | from ( | ||
| Line 26: | Line 26: | ||
group by owner,table_name | group by owner,table_name | ||
order by owner,table_name | order by owner,table_name | ||
| + | </pre> | ||