通过 IBatis.Net 将大字符串传递给存储函数时出现问题
我有以下类型和功能:
CREATE OR REPLACE TYPE SERIAL_NUMBER_TABLE AS TABLE OF VARCHAR2(4000);
CREATE OR REPLACE FUNCTION F_DEVICE_SERIAL_TABLE(
SN_LIST IN CLOB,
SN_DELIMITER IN VARCHAR2 DEFAULT ';')
RETURN SERIAL_NUMBER_TABLE
IS
V_STRING LONG := SN_LIST || SN_DELIMITER;
V_POS PLS_INTEGER;
V_DATA SERIAL_NUMBER_TABLE := SERIAL_NUMBER_TABLE();
BEGIN
LOOP
V_POS := INSTR(V_STRING, SN_DELIMITER);
EXIT WHEN (NVL(V_POS, 0) = 0);
V_DATA.EXTEND;
V_DATA(V_DATA.COUNT) := TRIM(SUBSTR(V_STRING, 1, V_POS - 1));
V_STRING := SUBSTR(V_STRING, V_POS + 1);
END LOOP ;
RETURN V_DATA;
END F_DEVICE_SERIAL_TABLE;
我试图通过 IBatis 映射 xml 配置中的以下映射传递一个巨大的字符串:
<parameterMaps>
<parameterMap id="StringClob" class="DeviceAlias">
<parameter property="SerialNumber" type="String" dbType="CLOB"/>
</parameterMap>
</parameterMaps>
<select id="SelectBySerialNumberList" parameterMap="StringClob" resultMap="DeviceResult">
<![CDATA[
SELECT *
FROM DEVICE D
INNER JOIN
(SELECT * FROM TABLE(CAST(F_DEVICE_SERIAL_TABLE(?) AS SERIAL_NUMBER_TABLE))) SERIAL_TABLE
ON SERIAL_TABLE.COLUMN_VALUE = D.S_NUMBER
]]>
</select>
当我运行此代码时,传递具有巨大 SerialNumber 属性集的 DeviceAlias 对象(例如 SN0001;SN0002; ) ...),我收到以下错误:
ORA-01460: unimplemented or unreasonable conversion requested
有关如何解决此问题的任何想法吗? PS:对于小条目,此代码有效
I have the following type and function:
CREATE OR REPLACE TYPE SERIAL_NUMBER_TABLE AS TABLE OF VARCHAR2(4000);
CREATE OR REPLACE FUNCTION F_DEVICE_SERIAL_TABLE(
SN_LIST IN CLOB,
SN_DELIMITER IN VARCHAR2 DEFAULT ';')
RETURN SERIAL_NUMBER_TABLE
IS
V_STRING LONG := SN_LIST || SN_DELIMITER;
V_POS PLS_INTEGER;
V_DATA SERIAL_NUMBER_TABLE := SERIAL_NUMBER_TABLE();
BEGIN
LOOP
V_POS := INSTR(V_STRING, SN_DELIMITER);
EXIT WHEN (NVL(V_POS, 0) = 0);
V_DATA.EXTEND;
V_DATA(V_DATA.COUNT) := TRIM(SUBSTR(V_STRING, 1, V_POS - 1));
V_STRING := SUBSTR(V_STRING, V_POS + 1);
END LOOP ;
RETURN V_DATA;
END F_DEVICE_SERIAL_TABLE;
And I'm trying to pass a huge string through the following mapping in the IBatis map xml configuration:
<parameterMaps>
<parameterMap id="StringClob" class="DeviceAlias">
<parameter property="SerialNumber" type="String" dbType="CLOB"/>
</parameterMap>
</parameterMaps>
<select id="SelectBySerialNumberList" parameterMap="StringClob" resultMap="DeviceResult">
<![CDATA[
SELECT *
FROM DEVICE D
INNER JOIN
(SELECT * FROM TABLE(CAST(F_DEVICE_SERIAL_TABLE(?) AS SERIAL_NUMBER_TABLE))) SERIAL_TABLE
ON SERIAL_TABLE.COLUMN_VALUE = D.S_NUMBER
]]>
</select>
When I run this code passing a DeviceAlias object with a huge SerialNumber property set (e.g SN0001;SN0002;...), I get the following error:
ORA-01460: unimplemented or unreasonable conversion requested
Any ideas of how to get around this problem?
PS: For small entries, this code works
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此错误通常是在混合使用 PLSQL 和 SQL 时引起的。 SQL。
尝试将“dbType”(CLOB) 替换为“VARCHAR,如下所示:
其他可能的原因如下:
This error is normally caused when you mix PLSQL & SQL.
Try to replace your "dbType" (CLOB) with "VARCHAR as follows:
Other possible causes are as follows: