[Form Builder]:CREATE_GROUP Built-in

时间:2023-12-19 23:18:32

Description 

Creates a non-query record group with the given name. The new record group has no columns and no rows until you explicitly add them using the ADD_GROUP_COLUMN, the ADD_GROUP_ROW, and the POPULATE_GROUP_WITH_QUERY Built-ins.

Syntax                                                                                                           

FUNCTION CREATE_GROUP

(recordgroup_name VARCHAR2,

scope NUMBER,

array_fetch_size NUMBER);

Built-in Type unrestricted function

Returns RecordGroup

Enter Query Mode yes

Parameters                                                                                                                 

recordgroup_name  

   The string you defined as the name of the record group at design time. When Oracle Forms creates the record group object it also assigns the object a unique ID of type RecordGroup. You can call the record group by name or by ID in later calls to record group or record group column built-in subprograms.

scope

   Specifies whether tlhe record group can be used only within the current form or within every form in a multi-form application. Takes the following constants as arguments:

   FORM_SCOPE  Indicates that the record group can by used only within the current form. This is the  default value.

   GLOBAL_SCOPE  Indicates that the record group is global, and that it can be used within all  forms in the application. Once created, a global record group persists for the remainder of the runtime session.

array_fetch_size 

  Specifies the array fetch size. The default array size is 0.

CREATE_GROUP Examples                                                                                

/*** Built-in: CREATE_GROUP ** Example: Creates a record group and populates its values ** from a query. */
DECLARE
  rg_name VARCHAR2(40) := 'Salary_Range';
  rg_id   RecordGroup;
  gc_id   GroupColumn;
  errcode NUMBER;
BEGIN
  /* ** Make sure the record group does not already exist.*/
  rg_id := Find_Group(rg_name); /* ** If it does not exist, create it and add the two ** necessary columns to it. */
  IF Id_Null(rg_id) THEN
    rg_id := Create_Group(rg_name); /* Add two number columns to the record group */
    gc_id := Add_Group_Column(rg_id, 'Base_Sal_Range', NUMBER_COLUMN);
    gc_id := Add_Group_Column(rg_id, 'Emps_In_Range', NUMBER_COLUMN);
  END IF; /* ** Populate group with a query */
  errcode := Populate_Group_With_Query(rg_id,
                                       'SELECT SAL-MOD(SAL,1000),COUNT(EMPNO) ' ||
                                       'FROM EMP ' ||
                                       'GROUP BY SAL-MOD(SAL,1000) ' ||
                                       'ORDER BY 1');
END;