ORACLE存储过程 练习系列四 游标专题
- TABLE C
- PROCEDURE
create or replace procedure P_TEST_LOOP_CUR(in_test in varchar2) is /*************************************************************** *NAME : [Name] *PURPOSE : --更新表C的数据 添加bid外键数据 *IMPUT : --输入参数没意义 *UpdateDate : --函数更改信息(包括作者、时间、更改内容等) ************************************************************/ v_bid C.BID%type; cursor cur is select id from c; begin open cur; fetch cur into v_bid; WHILE cur%FOUND LOOP exit when not cur%found; --如果游标到尾则结束 update C set bid = v_bid where id = v_bid; fetch cur into v_bid; END LOOP; CLOSE cur; commit; end;