/*
** Built-in: ADD_GROUP_ROW
** Example: Add ten rows to a new record group and populate.
*/
PROCEDURE Populate_My_Group IS
rg_name VARCHAR2
(20
) :=
'My_Group';
rg_col1 VARCHAR2
(20
) := rg_name||
'.NumCol';
rg_col2 VARCHAR2
(20
) := rg_name||
'.CharCol';
rg_id RecordGroup;
gc_id GroupColumn;
in_words VARCHAR2
(15
);
BEGIN
/*
** Check to see if Record Group already exists
*/
rg_id := Find_Group
( rg_name
);
/*
** If it does, then clear all the rows from the group and
** populate ten rows with the numbers from 1..10 along
** with the equivalent number in words.
**
** Row# NumCol CharCol
** ---- ------ -------
** 1 1 one
** 2 2 two
** : : :
** 10 10 ten
*/
IF NOT Id_Null
(rg_id
) THEN
Delete_Group_Row
( rg_id, ALL_ROWS
);
FOR i IN 1..10 LOOP
/*
** Add the i-th Row to the end (bottom) of the
** record group, and set the values of the two cells
*/
in_words := TO_CHAR
(TO_DATE
(i,
'YYYY'),
'year');
Add_Group_Row
( rg_id, END_OF_GROUP
);
Set_Group_Number_Cell
( rg_col1, i, i
);
Set_Group_Char_Cell
( rg_col2, i, in_words
);
END LOOP;
END IF;
END;