在Oracle中,要批量更新多条数据可以使用以下方法之一:
MERGE INTO table_name dest
USING (SELECT id, new_value FROM updated_data) src
ON (dest.id = src.id)
WHEN MATCHED THEN UPDATE SET dest.column_name = src.new_value;
DECLARE
TYPE id_table IS TABLE OF table_name.id%TYPE INDEX BY PLS_INTEGER;
TYPE value_table IS TABLE OF table_name.column_name%TYPE INDEX BY PLS_INTEGER;
ids id_table;
values value_table;
BEGIN
-- 填充ids和values数组
FOR i IN 1..ids.COUNT LOOP
UPDATE table_name
SET column_name = values(i)
WHERE id = ids(i);
END LOOP;
END;
使用以上两种方法可以实现在Oracle数据库中批量更新多条数据。