--用ide编写如下Java文件,后缀为CUXPoExcelImport.java文件,上传到JAVA_HOME然后编译到oracle数据库loadjava -r -f -user apps/apps@ebsprod /u02/oracle/PROD/apps/apps_st/comn/java/classes/CUXPoExcelImport.java,再在form中调用即可
--需要准备jxl.jar文件,上传到JAVA_HOME然后编译loadjava -r -f -user apps/apps@ebsprod /u02/oracle/PROD/apps/apps_st/comn/java/classes/jxl.jar
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.DecimalFormat;
import jxl.Cell;
import jxl.NumberCell;
import jxl.Sheet;
import jxl.Workbook;
import oracle.jdbc.driver.OracleDriver;
public class CUXExcelImport {
public static String ExcelImport(int fileID) {
try {
Connection c = new OracleDriver().defaultConnection();
Statement s = c.createStatement();
ResultSet rs = s
.executeQuery("SELECT file_data FROM fnd_lobs WHERE file_id = "
+ fileID);
rs.next();
Blob blob = rs.getBlob("file_data");
Workbook wb = Workbook.getWorkbook(blob.getBinaryStream());
Sheet bomSheet = wb.getSheet(0);
int bomRows = bomSheet.getRows();
int bomcolumn = bomSheet.getColumns();