今天java小生贴出 java调用oracle function 的方法
List<WhiteBlackListInfo> whiteList = new ArrayList<WhiteBlackListInfo>();
List<List<String>> strList = new ArrayList<List<String>>();
Integer dataCount = 0;
Session session = null;
Connection con = null;
CallableStatement cstmt = null;
Transaction tr = null;
try {
session = getHibernateTemplate().getSessionFactory().openSession();
tr = session.beginTransaction();
con = session.connection();
cstmt = con.prepareCall("{? =call GETWHITELISTCOUNTBYSP(?,?,?,?,?,?,?)}");
cstmt.setString(2, startTime);
cstmt.setString(3, endTime);
cstmt.setInt(4, timeType);
cstmt.setInt(5, spID);
cstmt.setInt(6, pageSize);
cstmt.setInt(7, currentPage);
cstmt.registerOutParameter(1, Types.ARRAY, "WHITE_LIST_TYPE_ARRAY");//type
cstmt.registerOutParameter(8, java.sql.Types.INTEGER);
cstmt.executeUpdate();
dataCount = cstmt.getInt(8);
oracle.sql.ARRAY arry = (ARRAY) cstmt.getArray(1);
Array array = (Array) cstmt.getArray(1);
if (arry != null && arry.length() > 0) {
Object[] items = (Object[]) array.getArray();
Object obj;
for (int i = 0; i < items.length; i++) {
obj = items[i];
Struct a = (Struct) obj;
WhiteBlackListInfo wbInfo = new WhiteBlackListInfo();
wbInfo.setSpID(Integer.parseInt(a.getAttributes()[0]
.toString()));
wbInfo.setSpName(String.valueOf(a.getAttributes()[1]));
wbInfo.setSpCode(String.valueOf(a.getAttributes()[2]));
wbInfo.setSpTypeid(Integer.parseInt(a.getAttributes()[3]
.toString()));
wbInfo.setSpStatusid(Integer.parseInt(a.getAttributes()[4]
.toString()));
wbInfo.setWhiteListCount(Integer
.parseInt(a.getAttributes()[5].toString()));
whiteList.add(wbInfo);
}
}
tr.commit();
} catch (HibernateException e) {
e.printStackTrace();
tr.rollback();
log.error(e.getMessage());
} catch (SQLException e) {
e.printStackTrace();
tr.rollback();
log.error(e.getMessage());
} catch (Exception e) {
e.printStackTrace();
log.error("error", e);
} finally {
;
}
分享到:
相关推荐
java调用oracle存储过程或者函数
ip地址的范围比较,oracle写的function,运行以后直接在java里面调用。
数据管理员的验证方式 2-12 使用密码文件验证 2-13 SQL*PLUS 2-14 Oracle 企业管理器 2-15 Oracle 企业管理器结构:基于 JAVA 的控制台和应用程序 2-16 Oracle 企业管理器结构:管理节点 2-17 Oracle 企业管理器...
oracle学习文档 笔记 全面 深刻 详细 通俗易懂 doc word格式 清晰 第一章 Oracle入门 一、 数据库概述 数据库(Database)是按照数据结构来组织、存储和管理数据的仓库,它产生于距今五十年前。简单来说是本身可视...
199、在ORACLE大数据量下的分页解决方法。一般用截取ID方法,还有是三层嵌套方法。 47 200、xml有哪些解析技术?区别是什么? 48 201、你在项目中用到了xml技术的哪些方面?如何实现的? 48 202、用jdom解析xml文件时...
6.JAVA池 不小于20M 20 7.Streams池 20 8.软件代码区: 20 9.程序全局区(PGA) 20 四. 实例的进程结构(实例=SGA + 后台进程) 20 1.DBWR (数据库写入进程) 21 2.LGWR(日志写入进程) 22 3.ARCH(归档进程)-可选...
xml Mysql Oracle SqlServer int int NUMBER smallint int(1) smallint(1) NUMBER(2) int memo text CLOB text datetime datetime TIMESTAMP datetime long bigint NUMBER bigint decimal decimal NUMBER(20,2) ...
{1}Java基础}{17}{chapter.1} {1.1}基本语法}{17}{section.1.1} {1.2}数字表达方式}{17}{section.1.2} {1.3}补码}{19}{section.1.3} {1.3.1}总结}{23}{subsection.1.3.1} {1.4}数据类型}{23}{section.1.4} {...
主要功能就是把数据存储隐藏起来,调用SQL, ORACLE,之类。我主要是用它调用数据库工厂创建。 大致看一下代码吧。 //----------//1.工厂基类(SQLServer工厂类)//----------unit ConnDBFactory_SQLServer;...
199、在ORACLE大数据量下的分页解决方法。一般用截取ID方法,还有是三层嵌套方法。 47 200、xml有哪些解析技术?区别是什么? 48 201、你在项目中用到了xml技术的哪些方面?如何实现的? 48 202、用jdom解析xml文件时...
The function of the database' rapid inquiry analysis allow you to carry out the operation of 功能数据库的快速调查分析,让您进行运作 the table data inquiry, edition and deriving-out: 表中的数据查询,...
你可以利用PHP连接包括Oracle,MS-Access,Mysql在内的大部分数据库。你可以在苍蝇上画图,编写程序下载或者显示e-mail。你甚至可以完成网络相关的功能。最好的是,你可以选择你的PHP安装版本需要哪些功能。引用...
其语法结构为: 过程:Create or replace procedure procname(参数列表) as PL/SQL语句块 函数:Create or replace function funcname(参数列表) return 返回值 as PL/SQL语句块 为便于理解,举例如下: 问题:假设...
SqlFunction类 11.7. 参数和数据处理的基本原则 11.7.1. 为参数设置SQL类型信息 11.7.2. 处理BLOB 和 CLOB对象 11.7.3. 在IN语句中传入一组参数值 11.7.4. 处理复杂类型的存储过程调用 12. 使用ORM工具进行...
SqlFunction类 11.7. 参数和数据处理的基本原则 11.7.1. 为参数设置SQL类型信息 11.7.2. 处理BLOB 和 CLOB对象 11.7.3. 在IN语句中传入一组参数值 11.7.4. 处理复杂类型的存储过程调用 12. 使用ORM工具进行...
7.SQL Server提供数据仓库功能,这个功能只在Oracle和其他更昂贵的DBMS中才有。 SQL Server 2000与以前版本相比较,又具有以下新特性 : 1.支持XML(Extensive Markup Language,扩展标记语言) 2.强大的...
11.4.5. SqlFunction类 12. 使用ORM工具进行数据访问 12.1. 简介 12.2. Hibernate 12.2.1. 资源管理 12.2.2. 在Spring的application context中创建 SessionFactory 12.2.3. HibernateTemplate 12.2.4. 不使用...
-- 首先,以超级管理员的身份登录oracle sqlplus sys/bjsxt as sysdba --然后,解除对scott用户的锁 alter user scott account unlock; --那么这个用户名就能使用了。 --(默认全局数据库名orcl) 1、...
11.4.5. SqlFunction类 12. 使用ORM工具进行数据访问 12.1. 简介 12.2. Hibernate 12.2.1. 资源管理 12.2.2. 在Spring的application context中创建 SessionFactory 12.2.3. HibernateTemplate 12.2.4. 不使用回调...
十二、问题描述 通过Controler调用远程代理时报错,Error: CCI security error:You are running under secure mode and the function system is not allowed in this mode. 解决方法:在代理开启的时候,去掉勾选...