|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
random selection?
How to generate a random selection in oracle??
i do know that in mysql i can use rand(). |
|
#2
|
|||
|
|||
|
Hi,
use : select ... from sales sample(5) # or from sales sample(5) blocks the first will sample 5% out of the table whereas the second 4 block randomly. Good luck. |
|
#3
|
|||
|
|||
|
Hi, thanks for ur reply.
i tried something like this.. select * from product sample(5) blocks where rownum < 10 and also select * from product sample(5) # where rownum < 10 but it returns nothing. pls advise. |
|
#4
|
|||
|
|||
|
Hi Joyce,
the reason you probably not getting anything is because the table doesn't have statistics. what you need to do is: analyze table .... compute statistics; (if the table is large you better off replacing the compute statistics with estimate statistics sample 20 percent). Let me know if it helped. Galit. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > random selection? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|