如语句:type numbers is table of number index by binary_integer;其作用是,加了”index by binary_integer ”后,numbers类型的下标就是自增长,numbers类型在插入元素时,不需要初始化,不需要每次extend增加一个空间。
而如果没有这句话“index by binary_integer”,那就得要显示对初始化,且每插入一个元素到numbers类型的table中时,都需要先extend.
示例:
没加“index by binary_integer”时:
declare
type numbers is table of number;
n numbers := numbers();
begin
n.extend;
n(1) := 2;
n.extend;
n(2) := 3;
for i in1 .. n.count loop
dbms_output.put_line(n(i));
end loop;
end;
输出:2,3
而如果加了“index by binary_integer”,代码如下写就可以达到上面的效果
declare
type numbers is table of number index by binary_integer;
n numbers;
begin
n(1) := 2;
n(2) := 3;
for i in1 .. n.count loop
dbms_output.put_line(n(i));
end loop;
end;
分享到:
相关推荐
TYPE num_tab IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; v_example_tab1 num_tab; v_example_tab2 num_tab; v_num NUMBER :=13; BEGIN v_example_tab1(1):=1001; v_example_tab1(10):=1002; v_example_tab1(-10)...
Oracle 9i第2版扩充了INDEX BY表格功能,允许以文字为下标。这使得联合数组更像是其它语言,如Perl中的杂凑表格...为说明文字字符串可成为目录值,简单使用INDEX BY VARCHAR2,不要使用惯常的INDEX BY BINARY_INTEGER。
Type File_List is Table of VarChar2(32767) Index by Binary_Integer; is_FTPStatus VarChar2(800) := 'disconnect'; is_FTPPort Constant Integer := 21; is_TransferMethod Constant VarChar2...
本文将提供这样一个获取方法,需要的朋友可以参考下Sql代码 代码如下: — Created on 2010/06/08 by NAN declare — Local variables here TYPE t_test IS TABLE OF DATE INDEX BY BINARY_INTEGER; v_test t_test; v...
代码段如下: 代码如下: declare type t_indexby is table of number index by binary_integer; type t_nesteed is table of number; type t_varray is varray(10) of number; v_indexby t_indexby; v_nested t_...
BULK COLLECT(成批聚合类型)和数组集合type类型is table of 表%rowtype index by binary_integer用法笔记。 例1: 批量查询项目资金账户号为 “320001054663”的房屋账户信息并把它们打印出来 . DECLARE TYPE acct_...
3 type sqlStr_Array is table of varchar2(1000) index by binary_integer; 4 procedure excuteBulkData(sqlStr in sqlStr_Array); 5 end excuteBatchOperate; 2、在packagebody内创建存储过程 1 create ...
Type VarChar_Type is Table of VarChar2(400) Index By Binary_Integer; Type Number_Type is Table of Number(12,4) Index By Binary_Integer; Type DynamicCursor is ref Cursor; --动态游标 --...
TYPE tabletype IS TABLE OF type(类型名,要保存成的数据类型) INDEX BY BINARY_INTEGER; 例:DECLARE TYPE t_emp IS TABLE OF s_emp%ROWTYPE INDEX BY BINARY_INTERGER; v_emp t_emp; BEGIN SELECT * ...
值范围: Oracle8i National Language Support Guide 中指定的任何有效的10 字节字符串。 默认值: 从 NLS_TERRITORY 中获得 nls_date_language: 说明: 指定拼写日期名, 月名和日期缩写词 (AM, PM, AD, BC) 的语言。...
-- 首先,以超级管理员的身份登录oracle sqlplus sys/bjsxt as sysdba --然后,解除对scott用户的锁 alter user scott account unlock; --那么这个用户名就能使用了。 --(默认全局数据库名orcl) 1、...
Integer = Enables the buffer and sets its maximum size in bytes. ; Note: This directive is hardcoded to Off for the CLI SAPI ; Default Value: Off ; Development Value: 4096 ; Production Value: 4096 ; ...