UNIT 4

Data Object Date Object, Types of Data Objects , Variables, Rules for naming a variable in C, Constants Data Types, Looping, Data Objects, Structure, Specification of Data Structure types,Operations on Data Structures,Implementation of Data Structure Types,Vectors and Arrays,Initialization of Arrays,2- Dimensional Array.


Data Objects


The data in the data system that you implement with Oracle Warehouse Builder is stored in target schemas. This data is in the form of data objects such as tables, views, dimensional objects, and cubes. This section discusses relational and dimensional data objects that you design for your target system, and business intelligence objects for analytical views.



Types of Data Objects


Oracle Warehouse Builder uses relational and dimensional data objects and intelligence objects as follows:

Relational objects rely on tables and table-derived objects to store and link all of their data. Relational objects include tables, views, materialized views, and sequences.

Dimensional objects contain additional metadata to identify and categorize your data. Dimensional objects include dimensions and cubes.

Intelligence objects enable you to store definitions of business views. You can deploy these definitions to Oracle Business Intelligence Suite Enterprise Edition (OBI EE). In Oracle Warehouse Builder, intelligence objects are displayed under the Business Intelligence node in the Project Navigator.



Variables


In programming, a variable is a container (storage area) to hold data. To indicate the storage area, each variable should be given a unique name (identifier). Variable names are just the symbolic representation of a memory location. For example:

int playerScore = 95;

Here, playerScore is a variable of integer type. The variable is assigned value: 95. The value of a variable can be changed, hence the name 'variable'. In C programming, you have to declare a variable before you can use it.



Rules for naming a variable in C


A variable name can have letters (both uppercase and lowercase letters), digits and underscore only.

The first letter of a variable should be either a letter or an underscore. However, it is discouraged to start variable name with an underscore. It is because variable name that starts with an underscore can conflict with system name and may cause error.

There is no rule on how long a variable can be. However, only the first 31 characters of a variable are checked by the compiler. So, the first 31 letters of two variables in a program should be different.



Constants


A constant is a value or an identifier whose value cannot be altered in a program. For example: 1, 2.5, "C programming is easy", etc.

As mentioned, an identifier also can be defined as a constant.

const double PI = 3.14

Here, PI is a constant. Basically what it means is that, PI and 3.14 is same for this program.

Below are the different types of constants you can use in C.



Data Types


There are five basic data types associated with variables:

int - integer: a whole number.
float - floating point value: i.e. a number with a fractional part.
double - a double-precision floating point value.
char - a single character.
void - valueless special purpose type which we will examine closely in later sections.



Looping


You may encounter situations, when a block of code needs to be executed several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.
Programming languages provide various control structures that allow for more complicated execution paths.
A loop statement allows us to execute a statement or group of statements multiple times. Given below is the general form of a loop statement in most of the programming languages.



Data Objects


The data in the data system that you implement with Oracle Warehouse Builder is stored in target schemas. This data is in the form of data objects such as tables, views, dimensional objects, and cubes. This section discusses relational and dimensional data objects that you design for your target system, and business intelligence objects for analytical views.


Structure


Definition


A data object that is constructed as an aggregate of other data objects, called components, is termed as structured data object or data structure. A component may be elementary or it may be another data structure(ex, a component of an array may be a number or it may be a record, character string, or another array).



Specification of Data Structure types


Definition


The major attributes for specifying data structures include:
Number of components A data structure may be of fixed size if the number of components is invariant during lifetime or of variable size if the number of components changes dynamically. Arrays and records are common examples of fixed-size data structure and types: stacks, lists, sets, tables and files are examples of variable size types.
Type of each component A data structure is homogeneous if all its components are of same type. It is heterogeneous if its components are of different types. Arrays, sets, and files are usually homogenous, where as records and lists are usually heterogeneous.
Names to be used for selecting components. A data structure type needs a selection mechanism for identifying individual components of the data structure. For an array, the name of an individual component may be an integer subscript or sequence of subscripts; for a table, the name may be a programmer-defined identifier; for a record, the name is usually a programmer-defined identifier.
Organization of the components The most common organization is a simple linear sequence of components. Vectors(one-dimensional arrays), records, stacks, lists, and files are data structures with this organization. Arrays, record, and list types, however, are usually extended to multidimensional forms: multidimensional arrays, records whose components are records, and lists whose components are lists.



Operations on Data Structures


1.Component selection operation Two types of selection operations access components of a data structure and make them available for processing by other operations:
A) Random selection In which an arbitrary component of the data structure is accessed.
B) Sequential selection In which components are selected in a predetermined order.
2.Whole-data structure operations Operations may take entire data structures as arguments and produce new data structures as results. Most languages provide limited set of such whole-data structure operations(ex- addition of two arrays, a union operation on sets etc.
3.Insertion/deletion of components. Operations that change the number of components in a data structure have a major impact on storage representations and storage management for data structures.
4. Creation/Destruction of data structures Operations that create and destroy data structures also have a major impact on storage management for data structures.



Implementation of Data Structure Types


Two basic representations are as:
Sequential representation in which data structure is stored in a single contiguous block of storage. Sequential representations are used for fixed-size structures and sometimes for homogenous variable-size structures such as character strings or stacks. Linked representations are commonly used for variable-size structures such as lists.
Linked representation In which the data structure is stored in several noncontiguous blocks of storage, with the blocks linked together through pointers. A pointer form Block A to block B, called a link.



Vectors and Arrays


A vector is a data structure composed of a fixed number of components of the same type organized s a simple linear sequence. A component is selected by giving its subscript, an integer indicating the position of the component in the sequence. A vector is also termed as an one-dimensional array or linear array.



Initialization of Arrays


Assigning initial values to an array is called array initialization. An array can be initialized at either of the following stages:
a.At compile time
b.At run time



2- Dimensional Array


A two-dimensional array consists of both rows and columns of elements. It is essentially a matrix.