1
使用Oracle中的過程我想從輸入參數更新表中所有記錄的代碼字段。例如,如果參數值是100:更新Oracle中列值的過程
與代碼256變化到101
第2行的代碼368變化至102
3行與代碼624變化至103
行1 I嘗試此
create or replace PROCEDURE procedure_name (parameter_newcode code%TYPE) AS
CURSOR cursor_name IS select code from table
order by code asc;
var_newCode code%TYPE;
BEGIN
OPEN cursor_name;
LOOP
FETCH cursor_name INTO var_newCode;
EXIT WHEN cursor_name%NOTFOUND;
var_newCode:=parameter_newcode+1;
update table set code = var_newCode;
END LOOP;
CLOSE cursor_name;
END procedure_name;
但返回相同的代碼的每一行(例如,如果該參數爲100 - > 101)