ORACLE 讀寫 string longer than 4000 問題


  • ORA-01704: string literal too long
    *Cause:  The string literal is longer than 4000 characters.(寫入字串超過4000)
    *Action:  Use a string literal of at most 4000 characters. Longer values may only be entered using bind variables.(需使用變數裝載,再放到 insert sql中)
  • Ora-01489: result of string concatenation is too long
    *Cause: String concatenation result is more than the maximum size.(回傳值字串超過欄位規格)
    *Action: Make sure that the result is less than the maximum size.
    * select TO_CLOB(listagg(a,'_') WITHIN GROUP (ORDER BY sn )) from table;
    *在 CI +某個PHP版本,接收 CLOB 出現 json_encode 問題
    error_reporting(0);
    $query = $this->db->get();
    $data = $query->result_array();
    $data[0]['IM_CONTENT']->read($data[0]['IM_CONTENT']->size());

在資料庫設定為 utf8的環境下
varchar2(10 char)<=可以同時塞10個中文字
varchar2(10 byte)<=可以同時塞3個中文字,一個英文字
varchar2(10)<=可以同時塞3個中文字,一個英文字

http://cch8.blogspot.tw/2010/12/varchar2.html

lengthb(string)計算string所佔的byte長度
length(string)計算string所佔的char長度
ps.可以用length(string)=lengthb(string)判斷字符串是否含有中文。
http://blog.csdn.net/gavinvong/article/details/9101479
ORACLE 讀寫 string longer than 4000 問題 ORACLE 讀寫 string longer than 4000 問題 Reviewed by Wild on 10/27/2013 10:54:00 上午 Rating: 5

沒有留言:

沒有Google帳號也可發表意見唷!

技術提供:Blogger.