Jdbc调用包含用户定义表类型的oracle存储过程

时间:2019-02-21 08:26:33

标签: java oracle jdbc spring-jdbc

嗨,我在存储过程中的oracle中使用了userdefinedtypes 我想这样调用,并且可以用于userdefinedtype,但是当我要针对类型为userdefined的类型或表进行调用时,该时间将失败。任何人都可以共享包含表类型(如数组)的存储过程调用示例

对于单个TYPE_SPRINGBOOT_TEST可以正常工作   对于TABLE失败

SimpleJdbcCall testCall = new SimpleJdbcCall(new JdbcTemplate(connProvider.getDataSource()))
                .withSchemaName("MYSCHEMA")
                .withProcedureName("SP_SPRINTBOOT_TEST")
                .declareParameters(

 IN params
                                new SqlParameter("pn_input1", NUMBER),
                                new SqlParameter("ps_input2", VARCHAR),

                                // OUT params
                                new SqlOutParameter("pn_output1", NUMBER),
                                new SqlOutParameter("ps_output2", VARCHAR),
                                new SqlOutParameter("pt_output3", STRUCT, "TYPE_SPRINGBOOT_TEST", new SqlReturnSqlData(SQL_TESTOUTPUT.class))
                                new SqlOutParameter("pt_output3", STRUCT, "TYPE_SPRINGBOOT_TEST", new TestOutputHandler())
                        );

        TYPE_SPRINGBOOT_TEST output = (TYPE_SPRINGBOOT_TEST)(testCall.execute(28L,"Test Input").get("pt_output3"));

0 个答案:

没有答案