1 Feb 2020

  • February 01, 2020
  • Amitraj
DBTG Set Processing Facility -


Mechanisms are provided for inserting records into and removing
records from a particular set occurrence.


1. Insert a new record into a set by executing the connect
statement.

                      connect <record type> to <set-type>


Example:- 

DBTG query for creating new account A-267,
which belongs to johnson:

account.account number :="A-267";
account.balance :=0;
store account;
customer.customer name :="johnson";
find any customer using customer name;
connect account to depositer;




2. Remove a record from a set by executing the disconnect
statement.


            disconnect <record type> from <set-type>

Example:-

account.account-number := “A-201”;
find for update any account using account-number.
get account,
find owner within depositor,

disconnect account from depositor.



3. To move a record of type <record type> from one set occurrence
to another set occurrence of type <set-type>

-> Find the appropriate record and the owner of the set occurrences to which that record is to be moved.

-> Move the record by executing

                   reconnect <record type> to <set-type>

Example: -  Move all accounts of Hayes that are currently at the
Perryridge branch to the Downtown branch.




4. A newly created member record of type <record type> of a set
type <set-type> can be added to a set occurrence either explicitly
(manually) or implicitly (automatically).

-> Specify the insert mode at set-definition time via

                       insertion is <insert mode>




5. Restrictions on how and when a member record can be removed
from a set occurrence are specified at set-definition time via

                     retention is <retention-mode>

<retention-mode> can take one of the three forms:

1. fixed — a member record cannot be removed. To reconnect a
record to another set, we must erase that record, recreate it, and
then insert it into the new set occurrence.

2. mandatory — a member record of a particular set
occurrence can be reconnected to another set occurrence of only
type <set-type>.

3. optional — no restrictions on how and when a member record
can be removed from a set occurrence.




6. The best way to delete a record that is the owner of set
occurrence of type <set-type> depends on the specification of
the set retention of <set-type>.


-> optional — the record will be deleted and every member of the
set that it owns will be disconnected. These records, however,
will be in the database.

-> fixed — the record and all its owned members will be deleted; a
member record cannot be removed from the set occurrence
without being deleted.

-> mandatory — the record cannot be erased, because the
mandatory status indicates that a member record must belong to
a set occurrence. The record cannot be disconnected from that
set.


Translate

Popular Posts