SRW.GH_CREATE
built-in functionThis function creates and returns a group cursor (SRW.CURSOR
)
for groupName
.
Iterating across this cursor returns all the values for the group.
This function can also create and return a group cursor (SRW.CURSOR
)
for groupName
that is related to an existing group cursor
(parentCursor
). Iterating across this
existing group cursor returns all the values of the group based on the instance
of parentCursor
. For example, starting with a master
detail report of Dept-Emp, if you create a cursor for Dept and a cursor for
Emp that is related to the cursor for Dept, the Emp.next() will only return
the employees based on the current Dept row.
SRW.GH_CREATE (groupName IN VARCHAR) RETURN SRW.CURSOR
SRW.GH_CREATE (groupName IN VARCHAR, parentCursor IN SRW.CURSOR) RETURN SRW.CURSOR
Note: If parentCursor
is NULL, the function defaults to the same semantics as for
SRW.GH_CREATE (groupName IN VARCHAR)
Parameters |
Description |
|
Name of the group for which the group cursor is required. |
|
Name of an existing group cursor that is related to the group for which the group cursor is required. |
Exceptions |
Description |
|
No group with the given name was found in the data model of the report. |
|
The requested group does not exist with the parent cursor's group tree. |
This example creates a group cursor from data model values and iterates through
its value. The cursor is created on the master group (g_dept) and a related
cursor is created on a child group (g_emp) to return the employees by department.
SRW.GROUP_HANDLE
is a datatype that is an Oracle Reports implementation
of PL/SQL cursor; it is based on the data model.
FUNCTION group_cursor RETURN VARCHAR2 IS
gc_dept SRW.GROUP_HANDLE;
gc_emp SRW.GROUP_HANDLE;
l_check_char VARCHAR2(32676);
l_val_char VARCHAR2(20);
l_val_date DATE;
l_val_number NUMBER(9);
BEGIN
--Create cursor on master group
gc_dept := SRW.GH_CREATE('g_dept');
--Create cursor on child group for each record of master group
gc_emp := SRW.GH_CREATE(gc_dept,'g_emp');
LOOP
BEGIN
SRW.GH_NEXT(gc_dept);
SRW.GH_GET_VALUE(gc_dept,'deptno',l_val_number);
--CHR(10) is the enter key to give line break for proper formatting
l_check_char := l_check_char||'Department:'||TO_CHAR(l_val_number)||CHR(10);
LOOP
BEGIN
SRW.GH_NEXT(gc_emp);
SRW.GH_GET_VALUE(gc_emp,'ename',l_val_char);
SRW.GH_GET_VALUE(gc_emp,'hiredate',l_val_date);
--RPADing is done for proper formatting
l_val_char := RPAD(l_val_char,15);
l_check_char := l_check_char||l_val_char||l_val_date||CHR(10);
EXCEPTION
WHEN SRW.NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
EXCEPTION
WHEN SRW.NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
RETURN l_check_char;
END;
SRW.GH_GET_VALUE
built-in function
About the
Reports Builder built-in package (SRW
)
Copyright © 1984, 2005, Oracle. All rights reserved.