In Oracle Sql developer 11g, how do I generate a random integer and assign it to a variable? This is what I\'ve tried so far:
S_TB := SELECT dbms_random.value(1,
If you want to get a random number of n digits you can do this
CREATE OR REPLACE FUNCTION NUM_RANDOM(N IN NUMBER) RETURN NUMBER AS BEGIN RETURN TRUNC (DBMS_RANDOM.VALUE(POWER(10, N - 1), POWER(10, N) - 1)); END NUM_RANDOM;