--date2016-7-3
--select * from teachers
declarev_user_id number(5);
v_sex varchar2(20);
Cursor v_teacher_cusor is
select user_id,sex from teachers;
begin
v_user_id := 0;
open v_teacher_cusor;
fetch v_teacher_cusor into v_user_id,v_sex;
while v_teacher_cusor%found loop
if v_sex = '男' then
dbms_output.put_line('男 ' || v_user_id);
else
dbms_output.put_line('女 ' || v_user_id);
end if;
fetch v_teacher_cusor into v_user_id,v_sex;
end loop;
close v_teacher_cusor;
end;