I am trying to return a value from field tid in a specific row in Oracle SQL but I am getting a weird behavior.
First, I tried this:
select tid from
(
That is because dbms_random()
is called for each row, so it can generate duplicate results. Instead, if you want one random row, try something like this:
select tid
from (select tid,
row_number() over (order by dbms_random.value()) as seqnum
from Train
) t
where seqnum = 1;
This will always return the row with "seqnum = 1", but it will be a random tid
.