0
I have the query below, which I use to check IP’s valid collectors in the network for distribution of items for separation:
Select distinct IP, USUARIO, trunc(DATA)
from
PCN_ROMANEIO_ACESSO PRA
Where pra.STATUS = 'OK'
AND trunc(pra.DATA) = trunc(sysdate)
AND PRA.DATA_SAIDA IS NULL
AND IP <> '192.168.204.1'
AND NIVEL = 'S'
order by dbms_random.value
With the dbms_random.value
it eventually changes the position of the query results, but most of the time it maintains the same positions as the previous execution, as an example:
Is there any way, only with Oracle SQL, to "ensure" that the positions are all changed with each query execution?
I don’t know much about Oracle. But isn’t that possible : order by dbms_random.value,Rand() ? If I’m not mistaken this function internally uses the timestamp to sort randomly, so would guarantee the different result.
– Rafael Salomão
@Rafaelsalomão exists dbms_random.Andom, I put both but still gets the same result in up to 3 plays....
– Diego