向Oracle資料庫中CLOB插入資料報錯問題

2022-05-05 13:18:12 字數 317 閱讀 6651

今天在專案中向資料庫的clob屬性插入一段篇文章(1000~2000)字就會報乙個字串過長的錯誤。

網上說用流來處理,沒有這麼做。這像是乙個bug,只要把插入的資料,預設擴充到2000以上就ok了。

下面是這段**:

if((temp.length()>=1000)&&(temp.length()<=2000))

使用stringutils的rightpad方法使沒超過2000的部分,在右邊自動填充0,直到2008長度。

(乙個半角字元乙個位元組,乙個全形字符兩個位元組,所以漢字1000-2000,而英文2000-4000)

向oracle中clob欄位插入資料

sql create or replace directory dir1 as c oracle directory created.sql sql declare 2 l bfile bfile 3 l clob clob 4 l str varchar2 1000 5 begin 6 inser...

查詢oracle資料庫中clob欄位

語句 select from table name where dbms lob.instr 欄位名 clod型別 查詢條件 1,1 0 語法解釋 在oracle中,可以使用instr函式對某個字串進行判斷,判斷其是否含有指定的字元。其語法為 其中sourcestring代表源字串 deststri...

Oracle資料庫Clob轉化String亂碼問題

1.常規轉化 將clob型別轉換為string型別 param clob 存放內容的變數 return 返回clob型別的string型別內容.author xc public static string changeclobtostring clob clob throws exception,s...