Random value between a range - Page 2
DBAsupport.com Forums - Powered by vBulletin
Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Random value between a range

  1. #11
    Join Date
    Jan 2001
    Posts
    153
    i am just throwing some more light on random

    DECLARE
    v_random number;
    BEGIN
    dbms_random.seed(TO_CHAR(SYSDATE,'MM-DD-YYYY HH24:MI:SS'));
    --
    FOR i IN 1 .. 5
    LOOP
    v_random := dbms_random.value(0,1);
    dbms_output.put_line(v_random);
    END LOOP;
    END;



    Vijay.s

  2. #12
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Vijay,

    Your DBMS_RANDOM package is obviously not the package that Oracle supplies in its distribution from 8.0 onward. Yours must be one of those home made PL/SQL random generators that were available on the internet for releases 7.*. Obviously you have named this home made package with the same name oracle names its built-in random generator: DBMS_RANDOM (although I would strongly discourage the usage of the built-in names for user generated objects).

    Why the DBMS_RANDOM from your code could not be original SYS.DBMS_RANDOM package?

    1.) There is no function DBMS_RANDOM.VALUE in original package

    2.) DBMS_RANDOM.SEED procedure accepts only BYNARY_INTEGER parameter, while you parameter is string with nonnumerical characters

    3.) You must first initialize the package (supply an initial seed value) with DBMS_RANDOM.SEED procedure before you start using it
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #13
    Join Date
    Feb 2001
    Location
    Master Control
    Posts
    86

    Talking good

    yes! jmodic is the dude/dudette. thanks for the example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width