/*创建临时表及存储过程*/
Create Global Temporary Table test1
(name varchar2(20),age int)
On Commit Delete Rows;
create or replace package addnum
is
type emp_table_type is table of varchar2(200)
index by binary_integer;
type emp_cur is ref cursor;
end;
/
create or replace procedure test2
(abc in out addnum.emp_table_type)
is
begin
abc(0) := 'aaaaa';
abc(1) := 20;
abc(3) := 'bbbbb';
abc(4) := 30;
end;
/
create or replace procedure test3
(ccc in out addnum.emp_cur)
is
cba addnum.emp_table_type;
begin
test2(cba);
insert into test1 values(cba(0),cba(1));
insert into test1 values(cba(3),cba(4));
end;
/
create or replace procedure test4
(e_cur in out addnum.emp_cur)
is
begin
test3(e_cur);
open e_cur for select * from test1;
end;
/
/*java调用*/
Connection conn = DaoUtil.getConnection();
conn.setAutoCommit(false);
CallableStatement call = conn.prepareCall("call test4(?)");
call.registerOutParameter(1, OracleTypes.CURSOR);
call.execute();
ResultSet rs = (ResultSet) call.getObject(1);
while(rs.next()){
System.out.println(rs.getString(1) + "," + rs.getInt(2));
}
conn.commit();
rs.close();
call.close();
conn.close();
分享到:
相关推荐
表示变量具有与数据库的表中某一字段相同的类型 例:v_FirstName s_emp.first_name%TYPE; 3. RECORD类型 TYPE t_emp IS RECORD( /*其中TYPE,IS,RECORD为关键字,record_name为变量名称*/ field1 type [NOT...
8.3.3 调用程序包中的函数/存储过程 157 8.3.4 程序包中的变量 158 8.4 本章实例 159 8.5 本章小结 161 8.6 习题 161 …… 第9章 游标(教学视频:36分钟) 162 第10章 触发器(教学视频:58分钟) 178 第11...
游标变量 D. 记录变量 18. 声明%TPYE类型的变量时,服务器将会做什么操作?( A ) A. 为该变量检索数据库列的数据类型 B.复制一个变量 C.检索数据库中的数据 D.为该变量检索列的数据类型和值 19.下列哪一项可以...
日期类型 date 7字节 用于存储表中的日期和时间数据,取值范围是公元前4712年1月1日至公元9999年12月31日,7个字节分别表示世纪、年、月、日、时、分和秒 二进制数据类型 row 1~2000字节 可变长二进制数据,在具体...
索引类似于书籍的目录,可以快速定位到相关的数据,一个表可以有多个索引。 创建索引: create index idx_temp_name on temp(name); 组合索引: create index idx_temp_name$pwd on temp(name, pwd); 删除索引...
说明: 用于指定数据库为远程 PL/SQL 存储的过程处理被依赖对象的方式。如果设置为 TIMESTAMP, 只有在服务器与本地时间戳相匹配的情况下, 才能执行该过程。如果设置为 SIGNATURE, 在签名安全的情况下即可执行该过程。...
3.3.4 使用列表临时存储数据 42 3.3.5 处理集合 43 3.4 本章小结 44 3.5 习题 44 第Ⅱ部分 Python语言和标准库 第4章 做出决策 49 4.1 比较两个值是否相等 49 4.2 比较两个值是否不相等 51 4.3 比较两个值的大小 51 ...
1、表(TABLE)基本的存储单位,由行和列组成。.............. 2、方案:一个用户所有对象的命名集合。..................... 3、CTAS(子查询建表):................................... 4、截取:.................
PART I – 概览.........................................................................................................................11 第 1章 – DB2 Express-C是什么?..................................
资源简介 第 1章 – DB2 Express-C是什么?...................................................4.1.1 环境变量......................................................................................................