oracle array
来源:互联网 发布:kahn算法 编辑:程序博客网 时间:2024/06/05 03:28
--1, 固定长度数组set Serveroutput On DECLARE -- 定义varray 定义size ,of varchar2(10) 定义类型 TYPE arry_var IS VARRAY(3) OF VARCHAR2(10); arry_name arry_var;BEGIN -- init array arry_name := arry_var('china', 'japan','usa'); dbms_output.put_line(arry_name(1));END; --2, 可变长度set serveroutput ondeclare type t_table is table of Varchar2(15) index by binary_integer; v_arr_table t_table; cnt int;begin v_arr_table(1) := 'china'; v_arr_table(2) := 'USA'; cnt := v_arr_table.count; for i in 1 .. cnt loop dbms_output.put_line(v_arr_table(i)); end loop;end;--3, 多维create table country( id int, name varchar2(15));insert into country values(1,'china');insert into country values(2,'USA');commit;set serveroutput ondeclaretype t_r_country is record( id country.id%type, name country.name%type ); type t_array_country is table of t_r_country index by binary_integer; --或者这里使用 type t_array_country1 is table of country%rowtype index by binary_integer; v_array_country t_array_country; v_array_country1 t_array_country1;begin select id,name bulk collect into v_array_country from country; for i in 1 .. v_array_country.count loop dbms_output.put_line(v_array_country(i).name); end loop; for i in 1 .. v_array_country.count loop dbms_output.put_line(v_array_country(i).name); end loop;end;--4,对象类型create or replace type obj_country is object(id int,name varchar2(15));create or replace type tab_country is table of obj_country ;set serveroutput ondeclare v_array_country tab_country := tab_country();beginfor cur in (select id,name from country) loop v_array_country.extend; v_array_country(v_array_country.count) :=obj_country(cur.id,cur.name); end loop;end;
0 0
- oracle array
- oracle array sql
- Oracle Array 存储
- Oracle 存储过程 Array
- java中调用oracle array
- 把 arrayList转换成Oracle Array (存储过程参数Array)
- Oracle:PL/SQL 中如何使用Array
- Oracle:PL/SQL 中如何使用Array
- Java: Passing Array to Oracle Stored Procedure
- Java: Passing Array To Oracle Stored Procedure
- Oracle FORALL & PostgreSQL ? op any|all (ARRAY)
- COBOL array data insert into Oracle
- array
- Array#-
- Array#[]
- Array#<<
- Array
- array
- servlet中doGet()和doPost()的区别
- 性能测试之Tomcat优化
- cocos多线程加载资源
- cocos2d-lua屏幕截屏的方法,超好用,亲测可行
- 浅析Statement和PreparedStatement的区别
- oracle array
- 蓝桥杯-矩阵乘法
- Longest Substring Without Repeating Characters
- java对象类、XML格式的相互转换
- Android java 删除文件或文件夹的方法
- static修饰词
- cannot reload avd list问题
- 登山-C#-事件
- ACE模板知识积累-CSS部分-2-color