create or replace procedure test
as
type ref_cursor is ref cursor;
cursor_test ref_cursor;
my_id number;
my_my number;
begin
my_id := 1;
open cursor_test for
select name
from table1
where id=my_id;
loop
fetch cursor_test into my_my;
exit when cursor_test%notfound;
update table2 set id=my_my;
end loop;
commit;
close cursor_test;
end test;
/
as
type ref_cursor is ref cursor;
cursor_test ref_cursor;
my_id number;
my_my number;
begin
my_id := 1;
open cursor_test for
select name
from table1
where id=my_id;
loop
fetch cursor_test into my_my;
exit when cursor_test%notfound;
update table2 set id=my_my;
end loop;
commit;
close cursor_test;
end test;
/
解决方案 »
- 请教各位大侠oracle 9i 可不可以生成awr的报告啊?非常感谢
- oracle数据库开发工程师笔试、面试
- oracle中字符串转化为日期类型的办法?
- 着急啊!!如何根据表名从系统表里面取出主键对应的字段名称??
- Primary key 和 Unique column
- Oracle中有没有统计一个表有多少个字段的这样一个函数?
- 一个存储过程的问题?
- "未指定行"是什么意思?
- 各位老大,能否提供一个关于触发器和存储过程的基本原理和操作手册之类参考的东西啊
- 请教大神一个关于锁的问题
- 现遇问题(linux下oracle9i安装)如下,帮偶看看,谢过!!!
- 求助:如何更改maxextents的最大值限制???
比如:
aa := 'select * from table '||str;
这个str或许为空,或许是一个字符串,比如str :='where id=123'; 或者str :='where userid=456789';
这样的话aa就是一个字符串,那怎么把她作为一个sql语句来执行呢?
open cur for aa即可。下面可以继续fetch等操作。