Here is my procedure in the ORACLE database:
CREATE or replace PACKAGE MYPACK AS TYPE AssocArrayVarchar2_t is
table of VARCHAR(20) index by BINARY_INTEGER;
PROCEDURE TestVarchar2(
Param1 IN AssocArrayVarchar2_t,
Param2 IN OUT AssocArrayVarchar2_t,
Param3 OUT AssocArrayVarchar2_t);
END MYPACK;
CREATE or REPLACE package body MYPACK as PROCEDURE TestVarchar2(
Param1 IN AssocArrayVarchar2_t,
Param2 IN OUT AssocArrayVarchar2_t,
Param3 OUT AssocArrayVarchar2_t)
IS
i integer;
BEGIN
-- copy a few elements from Param2 to Param1
Param3(1) := Param2(1);
Param3(2) := NULL;
Param3(3) := Param2(3);
-- copy all elements from Param1 to Param2
Param2(1) := Param1(1);
Param2(2) := Param1(2);
Param2(3) := Param1(3);
-- insert some values to db
FOR i IN 1..3 LOOP
insert into T1 values(i,Param2(i));
END LOOP;
END TestVarchar2;
END MYPACK;
-------------------------------------------------
here is my sqlmap.xml file:
<alias>
<typeAlias alias="Parameters" type="AssocArray.Parameters, AssocArray"
/>
</alias>
<parameterMap id="procedure_Result" class="Parameters">
<parameter property="P1" direction="Input" column="Param1" />
<parameter property="P2"
direction="InputOutput" column="Param2" />
<parameter property="P3"
direction="Output" column="Param3" />
</parameterMap>
<statements>
<procedure id="call_procedure" parameterMap="procedure_Result">
MyPack.TestVarchar2
</procedure>
</statements>
--------------------------------------
and Parameters class:
namespace AssocArray
{
/// <summary>
/// Summary description for Parameters.
/// </summary>
public class Parameters
{
private string[] p1;
private string[] p2;
private string[] p3;
public Parameters()
{
}
public string[] P1 {
get { return p1; }
set { p1 = value; }
}
public string[] P2 {
get { return p2; }
set { p2 = value; }
}
public string[] P3 {
get { return p3; }
set { p3 = value; }
}
}
}
But the I got the following error when I run the program:
- The error occurred while loading SqlMap.
- loading procedure tag
- The error occurred in <sqlMap embedded="Resources.assocarray.xml,
AssocArray"
xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the call_procedure.
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
docu
ment, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao
)
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Configure(String
resou
rce)
...........
What is wrong?
-Henry