UPDATE a_person p
SET p.avatar = nvl2(mobi_number, SUBSTR(utl_encode.base64_decode(hextoraw(mobi_number)),-10), email)
WHERE p.avatar IS NULL;
SET p.avatar = nvl2(mobi_number, SUBSTR(utl_encode.base64_decode(hextoraw(mobi_number)),-10), email)
WHERE p.avatar IS NULL;
解决方案 »
- 求救!!java.sql.SQLException: Io 异常: The Network Adapter could not establish the co
- [求助]Oralce数据库有关Package的问题
- 请问这句T-SQL在Oracle中怎么写。
- 怎么使用户默认访问指定的表?
- winXP上新安装的数据库在Enterprise Manager中登陆时报错“没有监听”怎么解决?
- Oracle自带的Servlet Engine占用我的8080端口,导致我tomcat起不来,增样去掉它!
- 请教高手
- 请问oracle中有没有自定义的数据类型??
- pl/sql中如何取得随机数?
- ORACLE 对象中,如何用alter type 增加对象函数?
- 请大师指点迷津-关于sql查询
- 缺失关键字
)
is
v_nicheng varchar2(20);--id 为a_person主键
v_count number;
cursor c_find is
select * from a_person;
cc c_find%rowtype;
begin
RetMemo :='';
v_count :=0;
open c_find;
loop
fetch c_find into cc;
exit when c_find%notfound;
if cc.nicheng is null then
if cc.phone is null then
v_nicheng :=cc.mail;
else
v_nicheng :=substr(utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw(cc.phone))),-10);
end if;
update a_person set nicheng=v_nicheng where id = cc.id;
commit;
v_count :=v_count+1;
end if;
end loop;
close c_find;
RetMemo:=RetMemo||'更新了'||v_count||'条数据';
exception
when others then
begin
rollback;
RetMemo := sqlerrm;
return;
end;
end;差不多是这个样子吧