Orcale中一个简单的存储过程刷数据库数据

xiaoxiao2021-02-28  112

为什么写这个存储过程,已经在我的<MySql中一个简单的存储过程刷数据库数据>已经说过了,这里不赘述了.

两张表,一张表字段为空的话,就从另外一张表字段取数据更新.代码如下:

create or replace procedure My_test_proce as   cursor test_cur is select Id from test_table_tmp where content is null or content = '';--<mysql这篇文章里这多取了content> begin        for a in test_cur loop       update test_table_tmp set content = (select content from 另外一个表 where ID =a.Id) where id = a.Id       commit;   end loop; end; --调用存储过程 begin   My_test_proce(); end;

这个我这边没有测试对错.朋友测试了.应该没有什么问题.写完mysql和orcale,突然感觉同样一个功能实现,Mysql实现起来就显复杂点.

转载请注明原文地址: https://www.6miu.com/read-51121.html

最新回复(0)