I have the following query:
select *
from (select employee_id, email,
case
when dbms_random.value () < 0.5
then 'S'
end as status
from hr.employees)
where status is not null
The inner query does what I expect, namely return all employee records and about 50% of them have the 'S' status. Then I try to use the outer query to filter only employees with status 'S'. What I get, in this case, is about half the time no rows returned and about half the time all rows returned (including those with null status).
Any ideas?
Edited by: user6570265 on Jun 22, 2009 3:19 PM