通过其它两个表的关系,来 更新某一个表的一个字段值,
sql 代码
- CREATE OR REPLACE PROCEDURE proc_updateuser_region is
- cursor region_cur is
- select c.id, b.segment
- from co2segment b ,co2_region c
- where b.regionid = c.id;
- begin
- for my_cur in region_cur loop
- update co2user
- set region_id=my_cur.id
- where region_id is null and msisdn like SUBSTR(my_cur.segment, 0, 7)||'%';
- commit;
- end loop;
- end ;
本文介绍了一个使用PL/SQL过程来更新用户表中区域ID字段的方法。该过程通过连接两个表,根据特定条件(MSISDN号码前缀匹配区域段落)来更新用户表中的空区域ID。

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



