程序参数:
procedure get_user_profile (
i_attuid in ras_user.attuid%type,
i_data_group in data_group_tbl,
o_user_info_tbl out user_info_tbl,
o_service_tbl out service_tbl,
o_user_role_tbl out user_role_tbl,
o_permission_tbl out permission_tbl,
o_work_group_tbl out work_group_tbl,
o_business_domain_tbl out business_domain_tbl,
o_skill_tbl out skill_tbl,
retnum out number
)
Java代码:
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.setResultsMapCaseInsensitive(true);
String procedureName = "{call get_user_profile(?,?,?,?,?,?,?,?,?,?)}";
SimpleJdbcCall simpleJdbcCall =
new SimpleJdbcCall(jdbcTemplate).withCatalogName("ras_user_profile_pkg").withProcedureName(procedureName).declareParameters(
new SqlParameter("i_ATTUID", Types.VARCHAR),
new SqlParameter("I_DATA_GROUP", Types.ARRAY),
new SqlOutParameter("O_USER_INFO_TBL", Types.ARRAY),
new SqlOutParameter("O_SERVICE_TBL", Types.ARRAY),
new SqlOutParameter("O_USER_ROLE_TBL", Types.ARRAY),
new SqlOutParameter("O_PERMISSION_TBL", Types.ARRAY),
new SqlOutParameter("O_WORK_GROUP_TBL", Types.ARRAY),
new SqlOutParameter("O_BUSINESS_DOMAIN_TBL", Types.ARRAY),
new SqlOutParameter("O_SKILL_TBL", Types.ARRAY),
new SqlOutParameter("retnum", Types.NUMERIC));
dataGroup = new ArrayList<String>();
Map<String, Object> hm = new HashMap<String, Object>();
hm.put("i_ATTUID", attuid);
hm.put("I_DATA_GROUP", dataGroup.toArray());
hm.put("O_USER_INFO_TBL", Types.ARRAY);
hm.put("O_SERVICE_TBL", Types.ARRAY);
hm.put("O_USER_ROLE_TBL", Types.ARRAY);
hm.put("O_PERMISSION_TBL",Types.ARRAY);
hm.put("O_WORK_GROUP_TBL", Types.ARRAY);
hm.put("O_BUSINESS_DOMAIN_TBL", Types.ARRAY);
hm.put("O_SKILL_TBL", Types.ARRAY);
hm.put("retnum", Types.NUMERIC);
SqlParameterSource in = new MapSqlParameterSource().addValues(hm);
Map simpleJdbcCallResult = simpleJdbcCall.execute(in);
请在这里帮助我(我是新的两个),为什么我收到此错误:
SQL状态[99999];错误代码[17041];索引:: 1处缺少IN或OUT参数;嵌套异常是java.sql.SQLException:在index :: 1
处缺少IN或OUT参数
答案 0 :(得分:0)
You should set the procedure's name and not the instruction to call the procedure:
String procedureName = "get_user_profile";