Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: random records wanted
There is a DBMS_RANDOM built-in package available in version 8. I haven't used it yet, but it looks simple to use. It's easy to find in the Oracle documentation, or O'Reilly's "Oracle Built-in Packages" book (excellent book by the way). The only way I can think to do it 'loosely' using SQL is to create a proc that puts a list of x number of random numbers (no dups) into a temp table. Then you can use the following steps:
That 'should' work, but it's not too pretty having to remember to execute that logic before each execution of the SQL. Alternatively, you could create a proc with the following logic:
Just some thoughts, as I've never used it before. I can think of a ton on ways to do it programmatically, but none in pure SQL. Hope that gives you some ideas...
Michael J. Ort
In article <38F1DA23.30EEB6D7_at_mediaaktiv.de>, Stefan <stefanp_at_mediaaktiv.de> wrote:
> Hi, > > got a song - database like > > titel NUMBER > categorie VARCHAR(2) > > just need about 60 songs of a specific categorie RANDOMLY > > how to do that ? > any workarounds ? > > thanx > stefan > >
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Apr 10 2000 - 00:00:00 CDT
![]() |
![]() |