declare
type MyRecord is record(
test2_str varchar(20),
test2_id number);
begin
for MyRecord in (select t.* from test2 t) loop
update test2 t set t.test2_str = MyRecord.test2_id where t.test2_id = MyRecord.test2_id;
end loop;
commit;
end;
这样声明更加的复合规范。
这里面MyRecord 代表一行,所以i可以取到test2当前纪录的test2_id
博客展示了在Oracle中声明记录类型MyRecord的代码,包含test2_str和test2_id字段。还给出了使用该记录类型进行循环更新test2表的代码,将test2_str更新为对应的test2_id值,最后提交事务,并指出这种声明更符合规范。
938

被折叠的 条评论
为什么被折叠?



