SQL>
SQL> CREATE OR REPLACE FUNCTION get_num (
2 p_highval NUMBER,
3 p_lowval NUMBER := 0,
4 p_scale PLS_INTEGER := 0
5 )
6 RETURN NUMBER
7 IS
8 l_ret NUMBER;
9 BEGIN
10 l_ret := ROUND (DBMS_RANDOM.VALUE (p_lowval, p_highval), p_scale);
11 RETURN l_ret;
12 END;
13 /
Function created.
SQL>
SQL> select get_num(5,2,2) from dual;
GET_NUM(5,2,2)
--------------
4.27
|