超过4000个字符在oracle上给字符串文字带来了太长的错误 [英] More than 4000 chars gives string literal too long error on oracle
问题描述
我当前在Codeigniter上使用oci8驱动程序. 在更新将具有4000个以上字符的字段时,出现错误消息:
I am currently using oci8 driver on Codeigniter. While updating a field that will have more than 4000 chars, I was given a error :
ORA-01704: string literal too long
因此,通过几个博客,我得到了:
So, going through few blogs, I got this:
declare
vClobVal varchar2(32767) := 'long text'
begin
update FMS_K_OFFICEWISE_LETTER set FKOL_LETTER_BODY=vClobVal
where FKOL_OFFICEWISE_LETTER_ID=240;
end;
当我向蟾蜍开火时,这对我有用. 现在,我创建了一个存储过程,并编译为:
This worked for me when fired at Toad. Now, I created a stored procedure and compiled as :
CREATE OR REPLACE PROCEDURE FMIS3.UPDATE_LETTER_BODY ( body_text IN FMS_K_OFFICEWISE_LETTER.FKOL_LETTER_BODY%type,condition_id in FMS_K_OFFICEWISE_LETTER.FKOL_OFFICEWISE_LETTER_ID%type)IS
begin
update FMS_K_OFFICEWISE_LETTER set FKOL_LETTER_BODY=body_text
end;
,并且此操作不能再次超过4000个字符.我无法定义varchar2的大小,因为它给了我错误.有什么建议吗?
and this does not work for more than 4000 chars again. Can't I define the size of varchar2 as it gave me error. Any suggestions ?
即使通过绑定参数尝试使用PDO,也只有在字符串的大小小于4000个字符时才有效:(
Even tried using PDO by binding parameters, works only when the string is of size less than 4000 chars :(
$conn = new PDO("oci:dbname=".$this->db->hostname,$this->db->username,$this->db->password);
$params = array(
':body_text' => "Long String"
);
$sth = $conn->prepare("update FMS_K_OFFICEWISE_LETTER set FKOL_LETTER_BODY = :body_text
where FKOL_OFFICEWISE_LETTER_ID=241");
$sth->execute($params) or die('error occured');
推荐答案
检查一下:
declare
vClobVal varchar2(32767) := 'long text'
begin
update FMS_K_OFFICEWISE_LETTER set FKOL_LETTER_BODY=vClobVal
where FKOL_OFFICEWISE_LETTER_ID=240;
end;
您确定不支持此操作吗?
Are you sure this is not supported ?
这篇关于超过4000个字符在oracle上给字符串文字带来了太长的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!