简体   繁体   English

使用存储过程执行时executeUpdate()不起作用

[英]executeUpdate() is no working while execute using stored procedure

executeUpdate return 1 but values are not inserted into the table. executeUpdate 返回 1,但值未插入表中。 'CR_SAVEHBCRPERFORMA ' is the procedure to insert values. 'CR_SAVEHBCRPERFORMA' 是插入值的过程。 output parameter return 1 after execute else 0, here return 0..(some code missed bcoz too length )执行 else 0 后输出参数返回 1,这里返回 0..(某些代码错过了 bcoz 太长)

    Connection con = null;
    CallableStatement cstmt1 = null;
    DataSource ds = null;
    ResultSet rs = null;
    try {
       
        String REGNO = request.getParameter("regNo");
        String CENTERNAME = request.getParameter("center");
        String DIAGNOSISDATE = request.getParameter("firstDiag");
        RccDataSources rccDS = new RccDataSources();
        ds = rccDS.getOncoLiveDS();
        con = ds.getConnection();
        cstmt1 = con.prepareCall("{CALL CR_SAVEHBCRPERFORMA(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
        cstmt1.setString(1, REGNO);
        cstmt1.setString(2, CENTERNAME);
        cstmt1.setString(3, DIAGNOSISDATE);
        cstmt1.setString(4, SOURCEREG);
        cstmt1.setString(5, SOURCEREF);
        cstmt1.setString(6, LABNO); 
        cstmt1.setString(7, FIRSTSEENDATE);
        cstmt1.setString(8, EDUCATION);
        cstmt1.setString(28, TREATMENTRITYPE);
        cstmt1.setString(29, STATUSFOLLOWUP);
        cstmt1.setString(30, DISEASESTATUS);
        cstmt1.setString(31, REMARK);
        cstmt1.registerOutParameter(32, Types.INTEGER);
        cstmt1.executeUpdate();
        int x = cstmt1.getInt(32);
  
    } 
}

} }

Use

cstmt1.execute();

For Example例如

        stmt.setString(1, doc_number);
        stmt.setString(2, doc_type);
        stmt.setString(3, line_number);
        stmt.registerOutParameter(4, oracle.jdbc.OracleTypes.CURSOR);
        
        stmt.execute();
        cursor = stmt.getCursor(4);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在执行以下代码时,在雪花存储过程中的 Statement.execute 中无法识别数值“+i+”? - Numeric value '"+i+"' is not recognized At Statement.execute in snowflake stored procedure while executing below code? 从LightSwitch HTML应用程序执行存储过程 - Execute Stored Procedure from LightSwitch HTML Application 在 NestJS 中执行 Oracle 数据库存储过程 - Execute an Oracle DB stored procedure In NestJS node-mssql将不会执行提供unhandlePromiseRejectionWarning的存储过程 - node-mssql won't execute stored procedure giving unhandlePromiseRejectionWarning 通过存储过程插入记录不起作用(使用乏味的MS SQL驱动程序) - Inserting Records via Stored Procedure Not Working (using Tedious MS SQL Driver) 如何在JavaScript上执行存储过程Confirmbutton在ASP.NET中单击 - How to Execute the Stored Procedure on Javascript Confirmbutton Click in ASP.NET 雪花存储过程为外部表执行创建语句 - Snowflake Stored Procedure to execute create statement for external table 在 Snowflake 中使用任务调用存储过程 - Calling a stored procedure using a task in Snowflake 使用存储过程重新组织数据列雪花 - reorganizing data columns Snowflake using stored procedure 使用雪花中的存储过程将值插入表中 - Inserting values into a table using stored procedure in snowflake
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM