Skip Headers

Oracle9i OLAP Developer's Guide to the OLAP DML
Release 2 (9.2)

Part Number A95298-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Reading Data from Files, 7 of 9


Processing Input Data

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".

Example 11-7 Modifying Values Read from a File

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

Specifying a Conversion Type for Data

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.


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2001, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback