I have this query which returns a set of rows, How can I loop through each row and display them using dbms.output.put_line? Please notice in the where clause there is a variable 'v_trainer_id', the variable value is known (retrieved from a column of a current row of another cursor). please help
select
customer.id as customer_id,
membership.join_date,
membership.join_fee,
round(months_between(sysdate, membership.join_date),0) as months_joined,
membership_plan.monthly_price,
membership.monthly_discount,
(membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0) as total_paid
from
membership,membership_plan,customer
where
membership.membership_plan_id = membership_plan.id and
customer.id=membership.customer_id and
membership.trainer_id = v_trainer_id
order by
customer.id;