Select random number from a list



Hi.

I have a table that will always have few records. In one of my
procedures I need to get the values from one of the fields of this
table, and randomly select one value from this list. This value will be
used to update a record on another table.

I am using Oracle 10g and read about the DBMS_RANDOM and
DBMS_RANDOMINTEGER but they can't help me, since I need to select a
value among a predefined list of values. Also, I tried the SAMPLE
clause, but there are times that the query returns no rows.

How can I code a procedure or function to return a random number from a
predefined list of values?

Thanks,
Robert Scheer

.



Relevant Pages

  • Re: default select order
    ... Now I'm wondering why 10g2 works like this (every time I query)? ... returned they should be coded with an ORDER BY clause ... ... guarantee from oracle that it won't change order otherwise. ... Plan hash value: 403654761 ...
    (comp.databases.oracle.server)
  • Re: default select order
    ... Now I'm wondering why 10g2 works like this (every time I query)? ... returned they should be coded with an ORDER BY clause ... ... guarantee from oracle that it won't change order otherwise. ... I do not understand your statement that the plans shoud be the ...
    (comp.databases.oracle.server)
  • Re: Optimisation of a sql query
    ... About using group by and having, I have to confess that the query I ... Shall I go ahead with the where clause as suggested ... passed on to the grouping (and possible sorting operation for Oracle ... you can start tuning the SQL statement. ...
    (comp.databases.oracle.server)
  • Re: default select order
    ... Now I'm wondering why 10g2 works like this (every time I query)? ... Valmis (refers to V) ... returned they should be coded with an ORDER BY clause ... ... guarantee from oracle that it won't change order otherwise. ...
    (comp.databases.oracle.server)
  • Re: LIKE clause
    ... I have a query that uses the Like clause like that (only relevant ... In fact, I would like the above SQL to show all records, if my ... Robert Scheer ...
    (comp.databases.oracle.misc)