本文主要是介绍%type 和%rowtype 的区别!,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
还是通过看一个例子来理解吧:
declare
i number; --这里的number是类型
u_name fnd_user.user_name%type;
--这里的u_name定义将用来存放表fnd_user中选出的user_name,
--那就将该变量定义成fnd_user表中user_name一样的类型.
cursor c is select * from fnd_user;
u_cur fnd_user%rowtype
--将u_cur定义成和fnd_user表中一行的数据类型一直以接收该行类型
begin
select a.user_name into u_name from fnd_user a where a.user_id=1;
--注意上面的用法
open c;
loop
fetch c into u_cur; --注意这里的用法
exit when c%notfound;
--在这里做一些其他的操作;
end loop;
close c;
end;
这篇关于%type 和%rowtype 的区别!的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!