create or replace procedure Test5(o_cellphone in varchar2) is v_cellphone cc_quiz_stat.cellphone %type; v_name cc_quiz_stat %rowtype; v_state cc_quiz_stat.state %type; begin declare cursor cur_cc is select * from cc_quiz_stat; cursor cur_jc(v_n varchar2) is select state from cc_quiz_stat; begin open cur_cc; loop fetch cur_cc into v_name; exit when cur_cc%notfound; open cur_jc(o_cellphone); loop fetch cur_jc into v_state; exit when cur_jc %notfound; if (o_cellphone = v_name.cellphone) then return; else dbms_output.put_line('手机号' || v_name.cellphone || '省份' || v_state); end if; end loop; close cur_jc; end loop; close cur_cc; end; end Test5;
create or replace procedure Test5(o_cellphone in varchar2) is v_cellphone cc_quiz_stat.cellphone %type; v_name cc_quiz_stat %rowtype; v_state cc_quiz_stat.state %type; begin declare cursor cur_cc is select * from cc_quiz_stat; cursor cur_jc(v_n varchar2) is select state from cc_quiz_stat; begin open cur_cc; loop fetch cur_cc into v_name; exit when cur_cc%notfound; open cur_jc(o_cellphone); loop fetch cur_jc into v_state; exit when cur_jc %notfound; if (o_cellphone = v_name.cellphone) then exit; else dbms_output.put_line('手机号' || v_name.cellphone || '省份' || v_state); end if; end loop; close cur_jc; end loop; close cur_cc; end; end Test5;