18.5 ADD_COLUMN_GROUP Procedure
This procedure adds a column group to the column group collection. Column group collections can be passed to the EXPORT
calls in order to group columns using an extra header row. If an empty column group collection (or no column group collection) passes, no column groups are added to the export. You can create multiple column group levels.
Syntax
PROCEDURE ADD_COLUMN_GROUP (
p_column_groups IN OUT NOCOPY t_column_groups,
p_idx OUT PLS_INTEGER,
p_name IN VARCHAR2,
p_alignment IN t_alignment DEFAULT c_align_center,
p_parent_group_idx IN PLS_INTEGER DEFAULT NULL );
Parameters
Parameter | Description |
---|---|
p_column_groups |
Column group collection. |
p_idx |
The generated index in the columns collection. |
p_name |
Column group name. |
p_alignment |
Column group alignment. Valid values are: LEFT , CENTER (default), RIGHT .
|
p_parent_group_idx |
The index of a parent column group. |
Examples
DECLARE
l_context apex_exec.t_context;
l_export apex_data_export.t_export;
l_column_groups apex_data_export.t_column_groups;
l_columns apex_data_export.t_columns;
-- Column group indexes
l_identity_idx pls_integer;
l_compensation_idx pls_integer;
BEGIN
l_context := apex_exec.open_query_context(
p_location => apex_exec.c_location_local_db,
p_sql_query => 'select * from emp' );
-- Define column groups
apex_data_export.add_column_group(
p_column_groups => l_column_groups,
p_idx => l_identity_idx,
p_name => 'Identity' );
apex_data_export.add_column_group(
p_column_groups => l_column_groups,
p_idx => l_compensation_idx,
p_name => 'Compensation' );
-- Define columns
apex_data_export.add_column(
p_columns => l_columns,
p_name => 'ENAME',
p_heading => 'Name',
p_column_group_idx => l_identity_idx );
apex_data_export.add_column(
p_columns => l_columns,
p_name => 'JOB',
p_heading => 'Job',
p_column_group_idx => l_identity_idx );
apex_data_export.add_column(
p_columns => l_columns,
p_name => 'SAL',
p_heading => 'Salary',
p_column_group_idx => l_compensation_idx );
apex_data_export.add_column(
p_columns => l_columns,
p_name => 'COMM',
p_heading => 'Commission',
p_column_group_idx => l_compensation_idx );
l_export := apex_data_export.export (
p_context => l_context,
p_format => apex_data_export.c_format_html,
p_columns => l_columns,
p_column_groups => l_column_groups,
p_file_name => 'employees' );
apex_exec.close( l_context );
apex_data_export.download( p_export => l_export );
EXCEPTION
when others THEN
apex_exec.close( l_context );
raise;
END;
Parent topic: APEX_DATA_EXPORT