ITPub博客

首页 > Linux操作系统 > Linux操作系统 > use collection method(count)

use collection method(count)

原创 Linux操作系统 作者:arthurshen_bleum 时间:2009-03-19 14:38:41 0 删除 编辑

create or replace procedure display_addresses(addresses_par nested_table_address_typ)is
count_var integer;
begin
     dbms_output.put_line('Current number of addresses = '||addresses_par.COUNT);
     for count_var in 1..addresses_par.count loop
     dbms_output.put_line('Address #' || count_var || ':');
     dbms_output.put(addresses_par(count_var).street||', ');
     dbms_output.put(addresses_par(count_var).city||', ');
     dbms_output.put(addresses_par(count_var).state||', ');
     dbms_output.put_line(addresses_par(count_var).zip);
     end loop;
end display_addresses;

create or replace type nested_table_address_typ as table of address_typ

create or replace type address_typ as object(
       street varchar2(15),
       city varchar2(15),
       state char(2),
       zip varchar2(6)
)

 

call display_addresses(nested_table_address_typ(address_typ('136 ****,'ShangHai','CA',201318)))

output:

Current number of addresses = 1
Address #1:
136 HengQiao, ShangHai, CA, 201318

call display_addresses(nested_table_address_typ(address_typ('137 *****,'ShangHai','CA',201318),address_typ('444 HengQiao','ShangHai','CA',201318)))

output:

Current number of addresses = 2
Address #1:
137 *******, ShangHai, CA, 201318
Address #2:
444 ******, ShangHai, CA, 201318

count 的用法,得出地址的数目。

 

 

 

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

上一篇: Rman06207
下一篇: asdfsda
请登录后发表评论 登录
全部评论

注册时间:2009-02-26

  • 博文量
    36
  • 访问量
    26285