程序已经实现功能,但是感觉写的很差,希望指正:-----function一定要有返回值,否则报错
CREATE OR REPLACE function sortbyregion_temp
return real
as
v_code integer;
p_number integer := 12;
p_error_info exception;
cursor type1_cur
is
select code from sys_dict where code like '404%' order by name;
BEGIN
------定义游标查找配置记录
open type1_cur;
loop
fetch type1_cur into v_code;
------当查找没有记录时退出
exit when type1_cur%notfound;
update sys_dict set bysort = p_number where code =v_code;
p_number := p_number + 2;
end loop;
close type1_cur;
return 0;
END;
CREATE OR REPLACE function sortbyregion_temp
return real
as
v_code integer;
p_number integer := 12;
p_error_info exception;
cursor type1_cur
is
select code from sys_dict where code like '404%' order by name;
BEGIN
------定义游标查找配置记录
open type1_cur;
loop
fetch type1_cur into v_code;
------当查找没有记录时退出
exit when type1_cur%notfound;
update sys_dict set bysort = p_number where code =v_code;
p_number := p_number + 2;
end loop;
close type1_cur;
return 0;
END;
解决方案 »
- sql查询条件的组合,各位朋友,求帮忙,谢谢!
- Oracel存储过程名称有长度限制吗
- 动态SQL语句
- oracle中select是否有与SQLServer top 10 percent相现的功能?
- 在sql server 中如何向异地的oracle 数据库中插入记录
- 如何将一个文本文件中的内容插入到数据表中?
- 导数据问题
- 连接数据时出现“ORA-01031:Insufficient Privilegse ”。救我!oldwain在吗?
- select * from amt2002 where code like '521._'; 对不对??
- 新人求助
- 字段数量和查询效率的关系?
- 求教一个简单的查询问题! 请高手帮忙
return real
as
v_code integer;
p_number integer := 12;
p_error_info exception;
cursor type1_cur
is
select code from sys_dict where code like '404%' order by name;
BEGIN
------定义游标查找配置记录
open type1_cur;
loop
fetch type1_cur into v_code;
------当查找没有记录时退出
exit when type1_cur%notfound;
update sys_dict set bysort = p_number where code =v_code;
p_number := p_number + 2;
end loop;
close type1_cur;
return 0;
END;