Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    2

    Unanswered: Selecting random row from table

    I need to select a random row from a table (Oracle 9i)

    I tried using:
    select *
    FROM mylearning.gelm_student_d
    where rownum = round(dbms_random.value(1, x))

    But it always returns rows 1-x , instead of 1 row. If I use a low value > 1, then it does not return any rows.

    Any suggestions on how to return 1 random row from a table?
    Thanks
    Jim

  2. #2
    Join Date
    Jan 2003
    Location
    Zutphen,Netherlands
    Posts
    256
    Ties Blom
    Senior Application Developer BI
    Getronics Healthcare
    DB2,ORACLE,Powercenter,BusObj,Access,
    SQL, SQL server

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296

    Thumbs up

    check out my answer under this thread:

    http://www.dbforums.com/showthread.php?threadid=889778

    shoudl solve your problem.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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