Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: can I select a single random row

Re: can I select a single random row

From: Baba Yetunde <nospam_at_nospam.com>
Date: Tue, 01 May 2001 17:20:41 GMT
Message-ID: <JfCH6.395$X91.35827@news1.cableinet.net>

Thanks for that chris. I think my initial problem was I did not seed DBMS_RANDOM. Still with this I cannot acheive what I want.

  1. What I need to is generate, a set of random numbers based on the amount of records in a table.
  2. Take for example table emp, which has ename, dept. I want to select the two columns and then add a third column which will be populated with the random numbers generated from above based on the number of records in the table.

Finally, I would then like to retrieve one row at random.

Is there any easy way of retrieving a single row at random?

F

"Chris Wiss" <chris_at_purecarbonnospam.com> wrote in message news:9clg1q$1agh$1_at_msunews.cl.msu.edu...
> You can use DBMS_RANDOM to assign a variable a random number value. You
 can
> then use the variable in an SQL statement.
>
> The error you describe indicates that you are trying to use DBMS_RANDOM in
 a
> SQL statement.
>
> Also, are you seeding and initializing the DBMS_RANDOM package before
 using
> it?
>
> Chris Weiss
> Chief Scientist
> PureCarbon
>
> "Baba Yetunde" <nospam_at_nospam.com> wrote in message
> news:HjlH6.15966$Mz.2205031_at_news1.cableinet.net...
> > Hi,
> >
> > I have a table that has a field for Question and a field for Answer. How
 can
> > I run a procedure to select one row of questions and answers. I have 100
> > Q&A's. I am using Oracle 8.0.6 on AIX, I have tried using the
> > dbms_random.random package, but gives an error message " Function can
 not
> > guarantee Not to update database"
> >
> >
> > Any help req.
> >
> > Fogun
> >
> >
>
>
Received on Tue May 01 2001 - 12:20:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US