ITPub博客

首页 > 应用开发 > IT综合 > table type usage sample:

table type usage sample:

原创 IT综合 作者:itpremier 时间:2010-09-19 17:18:37 0 删除 编辑

1, create or replace type ename_tab as table of varchar2(30) ;
2,

set serverout on
declare
p1 ename_tab ;
p2 ename_tab ;
begin

p1 :=ename_tab('') ;
--p2 :=ename_tab('') ;

p1.extend(2);
-- p2.extend(1);

p1(1) := 'Jack' ;
p1(2) := 'Mikel' ;
p1(3) := 'Dameon' ;

p2 := p1 ;

p2(1) := 'Jack-- 1' ;
p2(2) := 'Mikel--2' ;
p2(3) := 'Dameon--3' ;

dbms_output.put_line(p1(1)) ;
dbms_output.put_line(p1(2)) ;
dbms_output.put_line(p1(3)) ;
-- dbms_output.put_line(d) ;
end;
/
3, Conclusion:

1, the table type variable must be initizlize as like : tab_type('').

2, table variable Can be assigned directly just like scaler variable, and the assigned tab var is not required to initialized.

3, the assigned tab var and source tab var occupies difference memory space address.

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/350519/viewspace-1038604/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: pls_integer类型
请登录后发表评论 登录
全部评论

注册时间:2008-11-27

  • 博文量
    253
  • 访问量
    773710