<< Previous | Table of Categories | Next >> |
-- Feel free to copy and use this method
-- If you have any comments or better solutions, please paste on my blog:
-- http://blog.yanmingyu.com or email me: feedback.andrewyu@gmail.com
-- The following function will return a random integer which is
-- between the P_LOW(>=) and P_HIGH (<)
create or replace
FUNCTION NEXT_RAND_INT(P_LOW IN NUMBER, P_HIGH IN NUMBER)
RETURN NUMBER IS
V_NUM NUMBER(11);
BEGIN
SELECT floor(dbms_random.value(P_LOW, p_HIGH)) INTO V_NUM FROM DUAL;
RETURN V_NUM;
END NEXT_RAND_INT;
No comments:
Post a Comment