Oracle9i OLAP Developer's Guide to the OLAP DML Release 2 (9.2) Part Number A95298-01 |
|
Reading Data from Files, 7 of 9
Assignment statements created with the =
command have a wide application in the data-reading commands. With the =
command you can process any value read from a file in a variety of ways. Instead of just assigning the values as read to a variable or relation, you can modify those values to make them more suitable to your application.
The expression you use can be as simple or complex as you need. You can even perform conditional processing on the values read, based on other data already stored in your analytic workspace or previously read from the file.
For an example of using FILEREAD
commands using an assignment statement in a field description, see "Reading and Maintaining Dimension Values".
The following command reads sales data and assigns it to the variable sales
, replacing whatever value is already stored in that variable.
FILEREAD funit W 8 district W 8 product W 10 sales
Using an expression, however, you can add the new data to the value currently stored in the variable.
FILEREAD funit W 8 district W 8 product sales - = sales + W 10 VALUE
The data just read from the file is represented in the expression by the keyword VALUE
.
Suppose you have two different types of records in a file, you can read different fields for each type of record.
FILEREAD funit W 1 rectype W 8 district W 8 - APPEND product - prodname = - IF rectype EQ 'A' THEN COL 25 W 16 VALUE - ELSE COL 42 W 16 VALUE
In general, you do not need to specify a data type when you read input values into a workspace variable. By default, input values are converted to the data type of the target variable.
However, when the target variable has a data type of DATE
, you can use either the default conversion type of DATE
or an alternative conversion type of RAW DATE
.
You might also want to specify a conversion type when you use an expression to process input values before storing them in a target variable.
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|