I would like to select a random sample of the rows returned by my query. I have read the answer How to get records randomly from the oracle database? but I cannot get the dbms_random.random to work, so I tried with the sample function.
But I am getting an error when I request a sample of my values. A reproducible example would be: The example queries provided are just for reproducability, they have nothing to do with my actual usecase (as in I do not want to select 7 rows or something similar)
select * from (select 1,2,3,4,5,6,7 from dual) sample(0.1)
-- doesn't work
select * from (select 1,2,3,4,5,6,7 from dual)t sample(0.1)
-- doesn't work either
What am I doing wrong here? My goal is to select a random sample of the results of the subquery but I do not have privileges to use dbms_random.value
.