The following rules and restrictions apply to the use of the RANDOM function.
- RANDOM can only be called in one of the following SELECT query clauses:
- GROUP BY
- ORDER BY
- RANDOM cannot be referenced by position in a GROUP BY or ORDER BY clause.
- RANDOM cannot be nested inside aggregate or ordered analytical functions.
- RANDOM cannot be used in the expression list of an INSERT statement to create a primary index or partitioning column value.
INSERT t1 (RANDOM(1,10),...)
RANDOM causes an error to be reported in this case if the first column in the table is a primary index or partitioning column.