[sql]
set serveroutput on
DECLARE
CURSOR ids is
select customer_id
from customer_mst;
customers ids%ROWTYPE;
rnd NUMBER(2);
BEGIN
open corp2_ids;
LOOP
FETCH ids INTO customers;
–50~95の整数ランダム値を返す
rnd := trunc(DBMS_RANDOM.VALUE(50,95), 0);
DBMS_OUTPUT.PUT_LINE(rnd);
update customer_mst
set score = rnd
where customer_id = customers.customer_id;
EXIT WHEN ids%NOTFOUND;
END LOOP;
commit;
close ids;
END;
/
[/sql]