To select a table or view as data source:
To map a column or columns from the table or view to a database item in the data block, select the column(s) and:
To de-select a column
To move a column or columns out of the data block, select the column(s) and:
When you move a column from the Database Items list to the Available Columns list, if the item:
If the table you select is a user-defined object table, or a relational table
containing a column object, it will appear in the Available Columns window with
the object expanded. An outline format with indenting (similar to that used
by the Object Navigator) is used to show the composite parts of these objects.
Oracle Forms treats each component in an object table as a separate column,
and allows you to select these columns individually. The table need not be treated
as a single, homogeneous object. Similarly, a column object in a relational
table is expanded into its composite parts -- each one of which is treated as
a separate column and is individually selectable.
Suppose we had defined the following object type, and a table based upon it:
CREATE TYPE addr_type AS OBJECT
(street VARCHAR2(90),
city VARCHAR2(30),
area VARCHAR2(2));
CREATE TABLE address OF addr_type;
Then the Data Block Wizard would show all columns (street, city, and area) of this object table (address) in the Available Columns area and allow you to select any or all as data block items.
As a second example, consider a table based on an object definition, which itself referred to another object definition:
CREATE TYPE addr_type AS OBJECT
(street VARCHAR2(90),
city VARCHAR2(30),
area VARCHAR2(2));
CREATE TYPE emp_type AS OBJECT
(empno NUMBER,
ename VARCHAR(80),
address addr_type,
salary NUMBER);
CREATE TABLE emp_table of emp_type;
The emp_type object type is composed of four attributes, one of which (address)
is based on another definition -- the addr_type object type definition. Addr_type
itself defines three attributes. Thus, when we create a table based on the emp_type
type, the result is a table with six columns (empno, ename, street, city, area,
and salary). Again, the Data Block Wizard would show all six columns, and any/all
are selectable.
Consider a relational table that contains a column object based on the above object type of addr_type:
CREATE TABLE customer (custname CHAR(20), custaddr addr_type);
Then, in its Available Columns area, the Data Block Wizard would show the following for the customer table:
custname
custaddr
- street
- city
- area
Again, any or all of the columns custname, street, city, and area are selectable. Note that custaddr also appears as the name of the column object that contains street, city, and area. Selecting custaddr has the effect of selecting all of its parts -- but not custaddr itself. A column object name is only a label, and cannot be moved into the Database Items area (into the data block).
After you select part of an available column object to become a data item in the block, the item's default name takes the form ColumnObjectName_AttributeName. For instance, in the customer table example above, if you select city, it will appear in the Database Items area as custaddr_city You would use this compound name for the item in any coding in your application. (The name of the item's column name property is a slightly different format; it uses a dot or period as a connector, rather than an underscore.)
Normally, column objects contain data. REF columns, however, are a special type of object column; instead of containing data, they contain pointers to data that resides in other object tables.
REFs are shown expanded, listing the object attributes they point to. For example, if we defined dept_type as being an object type having three attributes -- deptnum, deptname, and deptloc, and we then defined a table having a REF column named deptref with type ref(dept_type), then the values in column deptref point to rows in a table having attributes of deptnum, deptname, and deptloc. In the Available Columns area, you can see:
R deptref
+ deptref
- deptnum
- deptname
- deptloc
Note that the REF column (deptref, in this case) appears twice. The first is the REF as a pointer. The second is a label for the composite parts (attribute columns) of the object being pointed to. This double listing allows you to make different types of choices, as explained below. Basically, your choice establishes where the data will be displayed at runtime -- in the pointing block or in the pointed-to block.
As with a regular column object, you can select any or all of a REF 's attribute
columns. Selecting the second instance of the REF name selects all its parts.
When you select one or more of the REF's attribute columns, they will appear
as normal data items in the data block at runtime. Oracle Forms and Oracle Database
Server will obtain the data values from the referenced table and show
those values in this block. (This is sometimes called a look-up technique.)
To the user, the REF data items appear no different than regular data items.
You can also select the REF itself (the first entry in the Available Columns
area) to become a programmable item in your application. (This is in contrast
to regular column objects, where the name is just a label.) Selecting the REF
itself allows the data block to become a detail block in a REF-based master-detail
relationship.
When you select the REF itself as an item, it is placed (by default) on the
Null Canvas. Although the REF item will not appear on the canvas to the runtime
user, it is available in the application for coding purposes.