Oracle® OLAP Expression Syntax Reference Release 11.2 Part Number E23381-01 |
|
|
PDF · Mobi · ePub |
ORA_HASH
generates hash values for an expression. You can use it to randomly assign a set of values into several buckets for analysis, or to generate a set of random numbers.
NUMBER
ORA_HASH (expr [, max_bucket [, seed_value ] ])
expr
can be any expression that provides the data for generating the hash values.
max_bucket
is the maximum bucket number. For example, when max_bucket
is set to 5, ORA_HASH returns values of 0 to 5, creating six buckets. Set this value from 0 to 4294967295 or 2^32-1 (default).
seed_value
is a value used by ORA_HASH
to generate the hash values. Enter a different seed_value
for different results. Set this value from 0 (default) to 4294967295 or 2^32-1.
ORA_HASH(PRODUCT_CUBE.PRICES, 5)
returns a value in the range of 0 to 5 for each value of the Prices measure, as shown in the Hash 5 column. The rows are also sorted on the Hash 5 column.
ORA_HASH(PRODUCT_CUBE.PRICES, 5, 13)
also returns values in the range of 0 to 5, but uses a different seed.
Product | Prices | Hash 5 | Seed 13 |
---|---|---|---|
ENVY STD | 200539.83 | 0 | 4 |
ENVY EXE | 255029.31 | 0 | 5 |
1GB USB DRV | 44645.65 | 1 | 2 |
DLX MOUSE | 1379.49 | 2 | 2 |
144MB DISK | 3011.43 | 2 | 5 |
512 USB DRV | 22139.99 | 2 | 2 |
19 SVGA | 34837.16 | 3 | 0 |
56KPS MODEM | 12478 | 3 | 2 |
ENVY EXT KBD | 4312.22 | 3 | 5 |
17 SVGA | 22605.55 | 4 | 1 |
EXT CD ROM | 17990.14 | 4 | 0 |
ENVY ABM | 205462.25 | 5 | 1 |