哪位能提供一些JAVA调用ORACLE存储过程的资料呢?

解决方案 »

  1.   

    Connection conn= DriverManager.getConnection(url,user,password); 
    String procedure = "{call 过程名}"; 
    CallableStatement cstmt = conn.prepareCall(procedure); 
    cstmt.executeUpdate();
      

  2.   

    Connection cnn = new Connection();
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource)ctx.lookup("java:/GimsDb");
    cnn = ds.getConnection();
    CallableStatement cs = new CallableStatement();
    cs = cnn.prepareCall(
    "{call sptest(?,?)}");db.cs.setString(1,"");
    db.cs.setString(2,"");
    cs.execute();
      

  3.   

    我有一个这样的存储过程,我怎么才能在JSP页面上得到一个表格数据呢?
    SET QUOTED_IDENTIFIER OFF 
    GO
    SET ANSI_NULLS OFF 
    GO
    --作者:杨健
    --作用:生成耕地占用税申报汇总表,按照部门内纳税人统计
    --修改:张俊波 2003-09-24
    ALTER  PROCEDURE Sp_LandTaxDeclareReportByTaxClient
    @intAreaID int,
    @intTaxClientID int,
    @intYear int,
    @dblLandUnitTimes decimal(18,2),
    @dblTaxMoneyUnitTimes decimal(18,2)
    AS
    declare @intAreaDigital int
    declare @intMoneyDigital int
    declare @intTaxRateDigital int
    select @intAreaDigital = convert(int, strSectionValue) from sys_SystemParameter where strSection='LAND' and strSectionName='面积小数'
    select @intMoneyDigital = convert(int, strSectionValue) from sys_SystemParameter where strSection='LAND' and strSectionName='金额小数'
    select @intTaxRateDigital = convert(int, strSectionValue) from sys_SystemParameter where strSection='LAND' and strSectionName='税率小数'

    SELECT
    strTaxClientCode AS [纳税人代码],
    strTaxClientName AS [纳税人名称],
    strTaxTypeName AS [项目类别],
    strUsage AS [占地用途],
    strConfirmFileNo AS [批准占地文号],
    strConfirmDate AS [批准占地日期],
    dblPermitArea*@dblLandUnitTimes AS [批准占用耕地面积],
    dblActualArea*@dblLandUnitTimes AS [实际占用耕地面积],
    dblTaxArea*@dblLandUnitTimes AS [计税面积],
    dblTaxRate AS [适用税率(元/平方米)],
    shouldTax*@dblTaxMoneyUnitTimes  AS [依率计征税额]
    FROM
    (
    select
    comm_taxClient.strTaxClientCode,
    comm_taxClient.strTaxClientName,
    comm_TaxType.strTaxTypeName,
    land_TaxDeclare.strUsage,
    land_TaxDeclare.strConfirmFileNo,
    land_TaxDeclare.strConfirmDate,
    round(land_TaxDeclareDetail.dblPermitArea, @intAreaDigital) as dblPermitArea,
    round(land_TaxDeclareDetail.dblActualArea, @intAreaDigital) as dblActualArea,
    round(land_TaxDeclareDetail.dblTaxArea, @intAreaDigital) as dblTaxArea,
    round(land_TaxDeclareDetail.shouldTax/land_TaxDeclareDetail.dblTaxArea, @intTaxRateDigital) as dblTaxRate,
    round(land_TaxDeclareDetail.shouldTax, @intMoneyDigital) as shouldTax
    from
    land_TaxDeclare
    inner join 
    (
    select 
    intTaxDeclareID,sum(dblPermitArea) as dblPermitArea,sum(dblActualArea) as dblActualArea,sum(dblTaxArea) as dblTaxArea,
    sum(land_TaxDeclareDetail.dblTaxArea*comm_LandTaxStandard.dblTaxRate) as shouldTax
    from 
    land_TaxDeclareDetail
    inner join comm_landTaxStandard on comm_landTaxStandard.intLandTaxStandardID=land_TaxDeclareDetail.intLandTaxStandardID
    group by
    intTaxDeclareID
    ) as land_TaxDeclareDetail on land_TaxDeclare.intTaxDeclareID=land_TaxDeclareDetail.intTaxDeclareID
    inner join comm_taxType on comm_taxType.intTaxTypeID=land_TaxDeclare.intTaxTypeID
    inner join comm_taxClient on land_taxDeclare.intTaxClientID=comm_TaxClient.intTaxClientID
    where
    land_TaxDeclare.intCheckerID>0
    and land_TaxDeclare.blnIsCancel=0
    and comm_taxClient.intTaxClientID=@intTaxClientID
    and land_TaxDeclare.strDate>=CONVERT(varchar(10),@intYear)+'-01-01 00:00:00'
    and land_TaxDeclare.strDate<=CONVERT(varchar(10),@intYear)+'-12-31 23:59:59'
    ) AS PMGO
    SET QUOTED_IDENTIFIER OFF 
    GO
    SET ANSI_NULLS ON 
    GO