Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jdbc 弹簧贮存工艺_Jdbc - Fatal编程技术网

Jdbc 弹簧贮存工艺

Jdbc 弹簧贮存工艺,jdbc,Jdbc,我们可以通过索引而不是名称将输出和输入参数传递给SQLParameter吗 /* This code snippet explains data access thru CallableStatement by registering the output and input params by index. */ Connection conn = getConnection(); CallableStatement sp = conn.prepareCall("p

我们可以通过索引而不是名称将输出和输入参数传递给SQLParameter吗

    /* This code snippet explains data access thru CallableStatement by registering the output and input params by index. */ 

    Connection conn = getConnection();
    CallableStatement sp = conn.prepareCall("pkg_name.proc_name");
    sp.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR);
    sp.registerOutParameter(2, oracle.jdbc.driver.OracleTypes.NUMBER);
    ResultSet rs = (ResultSet) sp.getObject(2);
这里可以根据索引获取resultset

请建议。

是的,我们可以。他是你的朋友

public void registerOutParameter(String parameterName,
                      int sqlType)
                      throws SQLException;

对不起,我错过了一些东西。对不起,我错过了一些东西。我正在尝试使用SpringAPI-StoredProcess。在使用这个时,我们必须按类型名传入输出和输入参数。是否有一种方法可以传递paramIndex而不是通过名称进行强绑定。私有类MyStoredProcedure扩展StoredProcedure{private static final String SQL=“sysdate”;公共MyStoredProcedure(DataSource ds){setDataSource(ds);setFunction(true);setSql(SQL);declareParameter(新的SqlOutParameter(“date”,Types.date));compile();}public Map execute(){//“sysdate”存储过程没有输入参数,因此提供了一个空映射…return execute(新的HashMap());}