sql - Error occurred while setting parameters -
i'm trying call procedure mybatis.
this procedure signature:
procedure pr_start(io_calc in out type_calc, in_restart boolean default true, in_user varchar2 default null);
it's in package named package_pp
.
this how type_calc
declared:
create or replace type type_calc object ( modelfield varchar2(5 char), sysfield varchar2(5 char), hexfield varchar2(5 char) );
this xml mapping:
<select id="pr_start" statementtype="callable" parametertype="map"> { exec package_pp.pr_start( #{io_calc,mode=inout,jdbctype=struct,jdbctypename=type_calc}, #{in_restart,mode=in,jdbctype=boolean,jdbctypename=boolean}, #{in_user,mode=in,jdbctype=varchar,jdbctypename=varchar2} ) } </select>
(p.s. tried call
instead of exec
, produces same error)
my java mapper:
public interface packageppmapper { object pr_start(map<string, object> param); }
this how call it:
object[] typecalcarr = new object[]{"a", "s", "0xd"}; webspherenativejdbcextractor wsn = new webspherenativejdbcextractor(); connection connection = wsn.getnativeconnection(session.getconnection()); //session sqlsession (properly initialized) structdescriptor descriptor = structdescriptor.createdescriptor("type_calc", connection); struct typecalc = new struct(descriptor, connection, typecalcarr); map<string, object> parametersmap = new hashmap<string, object>(); parametersmap.put("io_calc", typecalc); parametersmap.put("in_restart", restart); parametersmap.put("in_user", user); getmapper(session).pr_start(parametersmap);
stacktrace:
org.apache.ibatis.exceptions.persistenceexception: ### error querying database. cause: java.sql.sqlexception: non supported sql92 token @ position: 6 ### error may exist in com/jsfproj/mybatis/xmlmapper/packageppmapper.xml ### error may involve com.jsfproj.mybatis.packageppmapper.pr_start-inline ### error occurred while setting parameters ### sql: { exec package_pp.pr_start( ?, ?, ? ) } ### cause: java.sql.sqlexception: non supported sql92 token @ position: 6
what missing? should procedures called in other ways?
remove surrounding braces stop jdbc driver trying interpret query sql92-compatible query:
<select id="pr_start" statementtype="callable" parametertype="map"> call package_pp.pr_start( #{io_calc,mode=inout,jdbctype=struct,jdbctypename=type_calc}, #{in_restart,mode=in,jdbctype=boolean,jdbctypename=boolean}, #{in_user,mode=in,jdbctype=varchar,jdbctypename=varchar2} ) </select>
also it's possible use native oracle syntax:
<select id="pr_start" statementtype="callable" parametertype="map"> begin package_pp.pr_start( #{io_calc,mode=inout,jdbctype=struct,jdbctypename=type_calc}, #{in_restart,mode=in,jdbctype=boolean,jdbctypename=boolean}, #{in_user,mode=in,jdbctype=varchar,jdbctypename=varchar2} ); end; </select>
Comments
Post a Comment