%type 和%rowtype 的区别!

王朝学院·作者佚名  2010-01-02  
宽屏版  字体: |||超大  

还是通过看一个例子来理解吧:

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;

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/shenghuiping2001/archive/2009/12/30/5105661.aspx

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有