17,086
社区成员
发帖
与我相关
我的任务
分享
SQL> select * from v$version ;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
[/quote]
这么说,那是版本的问题了。
SQL> select * from v$version ;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
create or replace and compile java source named indicator as
package com.wonders.sjzl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
public class Indicator{
public final static String FAILURE="E";
public final static String CONNERR="C";
public final static SimpleDateFormat SDF=new SimpleDateFormat("yyyyMMdd");
public final static String[] list(Connection connection,String indicator_type,String indicator_code)throws Exception{
String[] returnValue=null;
StringBuffer sql=null;
ResultSet resultSet=null;
PreparedStatement preparedStatement=null;
ArrayList<String> list=null;
try{
sql=new StringBuffer(32);
sql.append("SELECT * FROM TB_INDICATOR WHERE INDICATOR_TYPE=?");
if(indicator_code!=null&!"".equals(indicator_code)){
sql.append(" AND INDICATOR_CODE=?");
}
list=new ArrayList<String>(8);
preparedStatement=connection.prepareStatement(sql.toString());
preparedStatement.setString(1,indicator_type);
if(indicator_code!=null&!"".equals(indicator_code)){
preparedStatement.setString(2,indicator_code);
}
resultSet=preparedStatement.executeQuery();
while(resultSet.next()){
list.add(resultSet.getString("INDICATOR_CODE"));
}
if(!list.isEmpty()){
returnValue=list.toArray(new String[list.size()]);
}
}finally{
if(resultSet!=null){
try{
resultSet.close();
}catch(Exception ne){
}
resultSet=null;
}
if(preparedStatement!=null){
try{
preparedStatement.close();
}catch(Exception ne){
}
preparedStatement=null;
}
}
return returnValue;
}
}
[/quote]
你可以试下,我觉得是我环境的问题,不知道 Oracle10G 支不支持 Java类型的存储过程create or replace and compile java source named indicator as
package com.wonders.sjzl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
public class Indicator{
public final static String FAILURE="E";
public final static String CONNERR="C";
public final static SimpleDateFormat SDF=new SimpleDateFormat("yyyyMMdd");
public final static String[] list(Connection connection,String indicator_type,String indicator_code)throws Exception{
String[] returnValue=null;
StringBuffer sql=null;
ResultSet resultSet=null;
PreparedStatement preparedStatement=null;
ArrayList<String> list=null;
try{
sql=new StringBuffer(32);
sql.append("SELECT * FROM TB_INDICATOR WHERE INDICATOR_TYPE=?");
if(indicator_code!=null&!"".equals(indicator_code)){
sql.append(" AND INDICATOR_CODE=?");
}
list=new ArrayList<String>(8);
preparedStatement=connection.prepareStatement(sql.toString());
preparedStatement.setString(1,indicator_type);
if(indicator_code!=null&!"".equals(indicator_code)){
preparedStatement.setString(2,indicator_code);
}
resultSet=preparedStatement.executeQuery();
while(resultSet.next()){
list.add(resultSet.getString("INDICATOR_CODE"));
}
if(!list.isEmpty()){
returnValue=list.toArray(new String[list.size()]);
}
}finally{
if(resultSet!=null){
try{
resultSet.close();
}catch(Exception ne){
}
resultSet=null;
}
if(preparedStatement!=null){
try{
preparedStatement.close();
}catch(Exception ne){
}
preparedStatement=null;
}
}
return returnValue;
}
}