【問題背景】:SSM專案,從系統表vSqlarea中獲取資料到自己另一張自建表msa_vsqlarea中。其中包含fulltext的CLOB欄位。自建表中同樣使用CLOB存放該欄位。
1、現從vSqlarea中同步資料到自建表msa_vsqlarea種。
2、在代碼邏輯中遍歷list,在mapper中insert插入。
<insert id="insert" parameterType="MsaVslqlarea">
insert into msa_vsqlarea
(
sql_id,
sql_text,
sql_fulltext,
first_load_time,
executions
)
values
(
#{sqlId, jdbcType=VARCHAR},
#{sqlText, jdbcType=VARCHAR},
#{sqlFulltext, jdbcType=CLOB},
#{firstLoadTime, jdbcType=VARCHAR},
#{executions, jdbcType=VARCHAR}
)
</insert>
【報錯資訊】:
ORA-00942 :table or view does not exist at oracle.jdbc.driver.T4CTTIoer(T4CTTIoer.java:450) .......
在此之前,后臺有后臺列印日志:
### SQL: insert into msa_vsqlarea (
sql_id,
sql_text,
sql_fulltext,
first_load_time,
executions
) values(?,?,?,?,?)
### Cause: java.sql.SQLException: ORA-01461 : can bind a Long value only for inset into a LONG colun
【初步定位】:
根據后臺日志了解到有兩種可能,
其一,ojdbc驅動問題,這個暫不確定。
其二,插數陳述句問題,超過4000個欄位插入CLOB時陳述句不能直接insert,需要用begin...end包含著。
已按方案二改過,少量資料測驗插入可行,大資料量暫未測驗。
<insert id="insert" parameterType="MsaVslqlarea">
declare
v_sql_fulltext CLOB := #{sqlFulltext, jdbcType=CLOB};
begin
insert into msa_vsqlarea
(
sql_id,
sql_text,
sql_fulltext,
first_load_time,
executions
)
values
(
#{sqlId, jdbcType=VARCHAR},
#{sqlText, jdbcType=VARCHAR},
v_sql_fulltext,
#{firstLoadTime, jdbcType=VARCHAR},
#{executions, jdbcType=VARCHAR}
);
end;
</insert>
具體原因暫未了解清楚,請教大佬分享經驗指導。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/41375.html
標籤:Web 開發
上一篇:將starter install到本地倉庫后,新建專案pom依賴沒問題,但在使用時卻無法匯入該包,求大神指教
下一篇:Jsoup post bytes
