[sql]
set serveroutput on
DECLARE
CURSOR customer_ids is
select customer_id
from customer_mst
where customer_id in
(select customer_id
from customers
where customer_id in
(select customer_id
from customer_lst
where customer_id = 126 ));
customers customer_ids%ROWTYPE;
BEGIN
open customer_ids;
LOOP
FETCH customer_ids INTO customers;
DBMS_OUTPUT.PUT_LINE(customers.customer_id);
update customer_mst
set exists_flg = 1
where customer_id = customers.customer_id;
EXIT WHEN customer_ids%NOTFOUND;
END LOOP;
commit;
close customer_ids;
END;
/
[/sql]