Java 设置jdbi调用参数时出错

Java 设置jdbi调用参数时出错,java,jdbc,Java,Jdbc,我得到了这个错误: UnableToExecuteStatementException:无法执行,没有与“nRoctizacion”匹配的命名参数,也没有为位置0(在JDBC“从1开始”方案中为1)设置位置参数 代码是: Handle h = null; try{ h = dbi.open(); String stmt = "{call pkg.test_procedure(:nroCotizacion,:ramo,:tipoVista,:planes)}

我得到了这个错误: UnableToExecuteStatementException:无法执行,没有与“nRoctizacion”匹配的命名参数,也没有为位置0(在JDBC“从1开始”方案中为1)设置位置参数

代码是:

Handle h = null;
    try{
        h = dbi.open();
        String stmt = "{call pkg.test_procedure(:nroCotizacion,:ramo,:tipoVista,:planes)}";

        ResultSet rs = (ResultSet) h.createCall(stmt)
                .bind("p_nuCotizacion", nroCotizacion)
                .bind("p_ramo", ramo)
                .bind("p_tipoVista",tipoVista)
                .bind("p_subproducto",planes)
                .registerOutParameter("v_titulos", OracleTypes.CURSOR)
                .registerOutParameter("v_datos", OracleTypes.CURSOR)
                .invoke();

        List<TituloCoberturaBeneficioTO> titulos = new ArrayList<TituloCoberturaBeneficioTO>();
        ResultSet rs2 = (ResultSet)rs.getObject("v_titulos");
        while(rs2.next()){  ......
handleh=null;
试一试{
h=dbi.open();
String stmt=“{call pkg.test_procedure(:nroctizacion,:ramo,:tipoVista,:planes)}”;
结果集rs=(结果集)h.createCall(stmt)
.bind(“p_nuCotizacion”,nroctizacion)
.bind(“p_ramo”,ramo)
.bind(“p_tipoVista”,tipoVista)
.bind(“p_子管道”,平面)
.registerOutParameter(“v_titulos”,OracleTypes.CURSOR)
.registerOutParameter(“v_datos”,OracleTypes.CURSOR)
.invoke();
List titulos=new ArrayList();
ResultSet rs2=(ResultSet)rs.getObject(“v_titulos”);
而(rs2.next()){。。。。。。

我不知道怎么回事,我是jdbi新手。

您的绑定参数名称必须与语句中的参数列表匹配。例如:

ResultSet rs = ...
...
.bind("nroCotizacion", nroCotizacion)
...

从绑定参数名称中删除
p
前缀,或修改语句以使用
p
前缀。

绑定参数名称必须与语句中的参数列表匹配。例如:

ResultSet rs = ...
...
.bind("nroCotizacion", nroCotizacion)
...

从绑定参数名称中删除
p
前缀,或修改语句以使用
p
前缀。

但语句中的参数应为nRoctization或“p\u Nucotization”?对不起,我最初的答案有一个输入错误。只要它在语句中匹配,并且在
bind
调用中绑定变量,那么使用哪个ID并不重要。现在的情况是:
:nroctizacion
在语句中,但
p_nuCotizacion
在绑定中。谢谢,这没问题。现在我有了这个错误:SQLException:java中p_subproducto的无效列类型是字符串[],y my db是xmltype。我如何设置它?您的db架构是什么样子的?我不知道您的意思。它是oracle 9i dbo,但station中的参数应该是nroctization或“p_nuCotizacion”?对不起,我最初的答案有一个输入错误。只要它在语句中匹配,并且在
bind
调用中绑定变量,那么使用哪个ID并不重要。现在的情况是:
:nroctizacion
在语句中,但
p_nuCotizacion
在绑定中。谢谢,这没问题。现在我有了这个错误:SQLException:java中p_subproducto的无效列类型为字符串[],y my db为xmltype。如何设置?您的db模式是什么样子的?我不知道您的意思。它是oracle 9i db