27.43 IS_GROUP_END Function

Returns whether an end of group was found. Group columns must not be NULL.

Syntax

APEX_EXEC.IS_GROUP_END (
    p_context   IN t_context )
    RETURN BOOLEAN;

Parameters

Parameter Description
p_context Context object obtained with one of the `OPEN_` functions.

Returns

TRUE, if successful; FALSE if no group change was found.

Examples

The following example executes a query and prints out the result set with control breaks.

DECLARE
    l_context               apex_exec.t_context;
    l_columns               apex_exec.t_columns;
    l_control_break         apex_exec.t_control_break;
    l_order_bys             apex_exec.t_order_bys;
BEGIN

    apex_exec.add_column(
        p_columns     => l_columns,
        p_column_name => 'EMPNO' );

    apex_exec.add_column(
        p_columns     => l_columns,
        p_column_name => 'ENAME' );
    apex_exec.add_column(
        p_columns     => l_columns,
        p_column_name => 'JOB' );

    apex_exec.add_column(
        p_columns     => l_columns,
        p_column_name => 'DEPTNO' );

    apex_exec.add_order_by(
        p_order_bys     => l_order_bys,
        p_column_name   => 'JOB',
        p_direction     => apex_exec.c_order_asc );

    apex_exec.add_order_by(
        p_order_bys     => l_order_bys,
        p_column_name   => 'DEPTNO',
        p_direction     => apex_exec.c_order_asc );

    apex_exec.add_column(
        p_columns     => l_control_break.control_break_columns,
        p_column_name => 'JOB' );

    apex_exec.add_column(
        p_columns     => l_control_break.control_break_columns,
        p_column_name => 'DEPTNO' );

    l_context := apex_exec.open_query_context(
        p_location         => apex_exec.c_location_local_db,
        p_sql_query        => 'select * from emp',
        p_columns          => l_columns,
        p_order_bys        => l_order_bys,
        p_control_break    => l_control_break );

    WHILE apex_exec.next_row( l_context ) LOOP

        sys.dbms_output.put_line( 'EMPNO: ' || apex_exec.get_number  ( l_context, 'EMPNO' ) );
        sys.dbms_output.put_line( 'ENAME: ' || apex_exec.get_varchar2( l_context, 'ENAME' ) );
        IF apex_exec.is_group_end( p_context => l_context ) THEN
            sys.dbms_output.put_line( 'Is end of Control Break' );
        END IF;

    END LOOP;

    apex_exec.close( l_context );
    RETURN;
EXCEPTION
    WHEN others THEN
        apex_exec.close( l_context );
        RAISE;
END;