PROCEDURE build_list (i_deptno in number) IS
rg_name varchar2(40) := 'Employees';
rg_id RecordGroup;
list_id item := find_item('dept.emps');
errcode number;
BEGIN
rg_id := find_group(rg_name);
if not id_null(rg_id) then
-- Record group exists - delete it before re-creating it
delete_group(rg_id);
end if;
-- Create the record group
rg_id := create_group_from_query(rg_name,
'select ename, to_char(empno) empno '||
'from emp '||
'where deptno = '||i_deptno );
errcode := populate_group(rg_id);
if errcode != 0 then
message('Error occurred while populating group: '||errcode);
end if;
clear_list(list_id);
populate_list(list_id,rg_id);
END;
|