A script-enabled browser is required for this page to function properly.

Populating a Query Record Group at Runtime

When you create and manipulate query groups programmatically, it is your responsibility to ensure that the values in the group are current with those in the database. Remember that the rows in a query group are only as current as the last call to POPULATE_GROUP or POPULATE_GROUP_WITH_QUERY.

Creating a query record group at runtime Examples

/* The following example creates a four-column record
** group based on two database tables, product and
** inventory.
*/

DECLARE
group_id  RecordGroup;
query_ok  NUMBER;
BEGIN
/* create the group prod_group and assign its id to the
** variable group_id */
group_id := Create_Group_From_Query ('prod_group',
'SELECT product.id, product.name,
inventory.warehouse_id, inventory.amount_in_stock
FROM product, inventory
WHERE product.id = warehouse.product_id');
/* now execute the new group's query, using the variable
** group_id to identify the group */
query_ok := Populate_Group(group_id);

/* if the query failed, abort this trigger by raising a
** predefined exception */
IF query_ok <> 0 THEN
RAISE Form_Trigger_Failure;
END IF;
END;

Replacing a record group's query Examples

/* The following example demonstrates replacing a
** record group's query at runtime: */

IF (Populate_Group_With_Query
('prod_group',
'SELECT product.id, product.name, inventory.warehouse_id,
inventory.amount_in_stock
FROM product, inventory
WHERE product.id = warehouse.product_id
AND inventory.amount_in_stock > 10'))
<> 0 THEN
RAISE form_trigger_failure;
END IF;


About record group Built-in subprograms

About manipulating a record group at runtime

Modifying an existing record group

Performing operations on rows

POPULATE_GROUP_WITH_QUERY Built-in

POPULATE_GROUP Built-in