標籤:介面 stop sage end bms etl 方法 限制 buffer
背景:ebs系統和其他系統通過utl_http包調用介面,使用log方法記錄日誌。
某次調用介面,執行到記錄日誌行報字元或值錯誤。
尋找原因,發現是p_str的長度超過的32747的限制。
解決辦法:
PROCEDURE log(p_str VARCHAR2) IS BEGIN fnd_file.put_line(fnd_file.log, p_str); dbms_output.put_line(p_str); END;
--解決l_messge_clob長度超過3276導致的溢出問題,字元或值錯誤FOR i IN 0 .. trunc((dbms_lob.getlength(l_messge_clob) - 1) / l_step) LOOP log(dbms_lob.substr(l_messge_clob, l_step, i * l_step + 1));END LOOP;--同樣 utl_http.write_text 長度不能超過32767,buffer VARCHAR2(2000);offset NUMBER := 1;amount NUMBER := 1024;--解決l_messge_clob長度超過3276導致的溢出問題,字元或值錯誤---utl_http.write_text(l_req, p_content);WHILE (offset < v_req_length) LOOP dbms_lob.read(p_content, amount, offset, buffer); utl_http.write_text(r => l_req, data => buffer); offset := offset + amount;END LOOP;
參考:
utl_http request and response stops when > 32k
UTTL_HTTP to POST CLOB request
http://www.orafaq.com/forum/t/202946/
記一次使用utl_http方法調用介面,報字元或值錯誤