Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-01 |
|
|
View PDF |
The GET function requests input from the current input stream. The input may be a single item of data, a dimension value, an analytic workspace object, or simply the next item in the input stream. The simplest form of the GET function requests a value of a certain data type.
GET(datatype)
GET also provides several arguments that verify the input.
Because GET is a function, it must be used in an OLAP DML command. It also may be used in an assignment statement to store the input in a variable for later use, or in a LIMIT command to set the status of a dimension. GET can be used in programs to request information necessary for the completion of the program.
Return Value
The return value depends on the input that you request, as described in the syntax.
Syntax
GET({RAW TEXT|[NEW|VALID|POSLIST] input} -
[VERIFY condition-exp [IFNOT result-exp]])
where input is one of the following:
Arguments
A text expression specifying the name of a dimension. When you specify dim-name, GET requests a value of this dimension as input and verifies that the input is a valid value of the dimension.
Specifies that GET should return the next item in the input stream exactly as it is entered. See "GET with RAW TEXT".
The NEW keyword with the dim-name argument causes GET to request a new value for the dimension. When requesting a dimension value with NEW, GET verifies that the input is not already a value of the dimension.
The VALID keyword with the dim-name argument causes GET to request either a new value or an existing value of the dimension. When requesting a dimension value with VALID, GET verifies that the input is either an existing dimension value or a valid new dimension value.
The POSLIST keyword with the dim-name argument causes GET to request a dimension value identified by its position in the dimension. When requesting a dimension value with POSLIST, GET verifies that the input is an existing position number in the dimension. See "GET with POSLIST".
Indicates that GET is requesting the name of an object in the current analytic workspace. When you specify NAME, GET verifies that the input is an object that exists in the current analytic workspace. The object name must not be enclosed in single quotes, and it must follow the rules for valid object names explained in the main DEFINE entry. GET automatically converts the object name to uppercase.
The NEW NAME keywords cause GET to request a name for a new analytic workspace object. When requesting an analytic workspace object name with NEW, GET verifies that the input is not already the name of an object in any attached analytic workspace (including EXPRESS.DB
).
The VALID NAME keywords cause GET to request a name for an analytic workspace object. When requesting an analytic workspace object name with VALID, GET verifies that the input follows the rules for valid object names, even when there is no current analytic workspace and regardless of whether the name already exists.
The POSLIST NAME keywords cause GET to request an analytic workspace object name identified by its position in the NAME dimension. When requesting an analytic workspace object name with POSLIST, GET verifies that the input is an existing position number in the NAME dimension.
Specifies the type of data being requested by GET. This can be any of the Oracle OLAP data types: INTEGER, SHORTINTEGER, DECIMAL, SHORTDECIMAL, BOOLEAN, ID, TEXT, or DATE. GET accepts a value of NA
when requesting any data type.
With VERIFY, you can specify a Boolean condition that must be satisfied by the input to GET. The keyword VALUE may be used in condition-exp to test the input before any assignment is made. For example, when requesting a value of LSIZE, the Boolean condition might be as follows.
VALUE NE NA AND VALUE GE 1 AND VALUE LE 80
The IFNOT clause specifies a text expression to provide for occasions when the input does not satisfy condition-exp. For example, you might jump to an error-handling routine in your program. When you do not use IFNOT and an error occurs, GET produces an error message and then resumes waiting for input.
Notes
Current Input Stream
Oracle OLAP obtains statements for processing from the current input stream. You can override your default input stream with an INFILE statement. INFILE causes Oracle OLAP to read input from a file. Each line of the infile must contain a single statement.
Input from INFILE
When the GET function is in an infile, Oracle OLAP considers the next line in the infile to be the input to GET. You must be sure you supply the expected input for GET in the line or lines following the statement that invokes the GET function.
For example, suppose your infile contains a line invoking a report program that calls GET to obtain the number of decimal places to use. The infile then continues with other statements. When you do not put the desired number of decimal places on the line following the program call, GET will examine line after line in the infile looking for the expected numeric response, rather than executing those lines as statements. See "Using GET to Obtain a Password".
INTEGER Dimension Values
When GET requests a value of an INTEGER dimension, the input should usually be in the form of a dimension-value position number
Non-INTEGER Dimension Values
Non-integer dimension values must be entered in uppercase and enclosed in single quotes.
Entering Values for DWMQY Dimensions
Values of DAY, WEEK, MONTH, QUARTER, or YEAR dimensions may be entered in the format of the dimension's VNF (or in the format of the default VNF when the dimension does not have a VNF of its own) or as a date. See VNF for an explanation of how to enter values in a VNF format. See DATEORDER for an explanation the valid input styles for entering values as dates.
Whether you use the VNF format or specify the value as a date, you need to specify only the date components that are relevant for this type of time dimension. For example, for a MONTH dimension, you need to supply only the month and year.
TEXT or ID Values
TEXT and ID values provided as input to GET retain the case in which they were entered. You do not need to enclose TEXT and ID values in quotes unless they begin with single or double quotes, or contain embedded blanks or escape sequences, such as \dnnn
or \n
. (Remember to precede any single quote in the value with a backslash (\'
) so Oracle OLAP will interpret it literally.)
DATE Values
When GET requests a DATE value, you can provide the input in any of the valid styles for dates, as explained in DATEORDER. Oracle OLAP uses the current value of the DATEORDER option to resolve any ambiguity in the DATE value.
Numeric Values
GET rounds a SHORTDECIMAL or DECIMAL value when converting it into an INTEGER value. When GET requests an INTEGER or SHORTINTEGER value and the input is a number beyond the range for that data type, GET produces an error message and resumes waiting for input.
GET with RAW TEXT
When GET requests RAW TEXT input and no input is provided, GET returns a null string (''
). For any type of information other than RAW TEXT, GET waits until input is provided.
GET with POSLIST
When you use the POSLIST keyword with the GET function, Oracle OLAP requires that you enter a position value to identify the dimension value rather than the dimension name. The syntax for the POSLIST keyword depends on whether you are using the GET function with either an assignment statement created using an assignment statement or the LIMIT command. When you want to set a variable equal to the result of a GET function, use the following syntax.
expression = GET(POSLIST dimension)
When you want to limit a dimension to a value returned by a GET function, you specify the POSLIST keyword twice, as shown in the following syntax.
LIMIT dimension TO POSLIST GET(POSLIST dimension)
Examples