日期:2014-05-17 浏览次数:20990 次
declare
-- Local variables here
random_num number;
begin
-- Test statements here
for rec in (select id,A,B from test)
loop
select trunc(dbms_random.value(1,10))
into random_num
from dual;
if random_num <= rec.A
then
update test t set t.B = 1 where t.id = rec.id;
end if;
end loop;
end;