今天使用sql在oracle直接insert update一个表时,出现ORA-01704: string literal too long的错误,我们的sql是

  1. update mall_config a set a.category_info='|标准件:1040140,1035382,1036586,1035383,1032451,1032469,141903,1036587,1044047,1035380,1035385,1455,1035379,1035376,1035464,141906,1046869,1035386,141909,1035377,141901,1046875,1042427,1032449,1035338,1035468,1046879,1035343,10353,1035466,1036788,1035467,1046874,1035446,1035341,1035449,1032470,1035339,1035342,1046868,1040201,1046870,1035447,1042428,1035463,1035340,1035450,1035445,1035444,1040197,1035381,1035629,1046877,141904,1035448,1035458,1035465,1040211,1035387,1035337,1035443,1035378,1042787,141902,1035388,141908,1046878,1042627,1032401,1046871,1035384,1036588,1035459......';

其中category_info字段是clob类型,而后面字符串内容很长,虽然clob可以足够可以保存这么长的字符串,但是sql语句的语法解析对字段却有长度限制,文字字符串过长!

有两种方法可以解决:

1.使用存储过程,把超长文本保存在一个变量中,然后再insert update

  1.  
    declare
  2.  
    v_clob clob :='一个长文本';
  3.  
    begin
  4.  
    insert into table values(a,3,:clob);
  5.  
    end;

2.字符串拼接,update使用字符串拼接

  1.  
    update mall_config set category_info='安全防护:3003,' where id=1;
  2.  
    update mall_config set category_info=category_info||'|标准件:1040140,1035382,' where id=1;

这都可以解决问题。

 

oracle ORA-01704: string literal too long问题分析的更多相关文章

  1. oracle ORA-01704: string literal too long

    导出数据时,在SQL拼接处,提示 oracle ORA-01704: string literal too long sql:  WITH already_in AS (SELECT distinct ...

  2. ORA-01704: string literal too long

    update mkt_page_links set longdescription = ' {some html text > 4000 char} ' where menuidno = 310 ...

  3. 使用MySql数据库, 浏览器接收返回数据报错SyntaxError: unterminated string literal

    用php写了一个很简单的页面, 用来记录常用的oracle的关键字和各种函数, 以后用起来查一下方便, 原来是用java写了一个web项目, 但是用起来太麻烦, 真的不如php方便, 然后就把整理的内 ...

  4. JAVA问题String literal is not properly closed by a double-quote

    String literal is not properly closed by a double-quote 这个错误:string字串没有以双引号结束String DBURL = "jd ...

  5. format not a string literal and no format arguments

    今天cocos2d-x打包 android的时候报错:format not a string literal and no format arguments 报错点是:__String::create ...

  6. Android studio2.2 ndk 错误 :format not a string literal and no format arguments!

    在Android Studio2.2 进行NDK编程,在对*char 字符串 进行日志输出时,报错: error: format not a string literal and no format  ...

  7. C++11:新式的字符串字面常量(String Literal)

    自C++11起,我们可以定义 raw string 字符串字面常量. Raw string 允许我们定义所见即所得的字符串字面常量,从而可以省下很多用来修饰特殊 字符的符号. Raw string 以 ...

  8. cocos2dx android版本移植时的Error format not a string literal and no format arguments解决方案

    原文地址 : http://www.cnblogs.com/hhuang2012/p/3336911.html cocos2dx android版本移植时的Error format not a str ...

  9. Error format not a string literal and no format arguments解决方案

    原地址: http://blog.csdn.net/joeblackzqq/article/details/25985299 cData.cpp:355:30:error:format not a s ...

随机推荐

  1. SpringDataRedis使用说明常用方法

    stringRedisTemplate.opsForValue().set("test", "100",60*10,TimeUnit.SECONDS);//向r ...

  2. 【神乎其神】这些EXCEL技巧,太神奇了,赶紧收藏!

    转:http://learning.sohu.com/20160215/n437421658.shtml

  3. datasnap中间件如何控制长连接的客户端连接?

    ActiveConnections: TClientDataSet; ... 有客户端连接上来的时候 procedure TForm8.DSServer1Connect(DSConnectEventO ...

  4. 什么是WPF? 秒懂 !

    一開始听到WPF.认为非常陌生.在百度百科等地方看完简单介绍之后.感觉更深奥.各种不懂啊! 在简单做了几个页面之后,发现.原来如此! So Easy 但又So Magic. 为什么说它简单?由于它简直 ...

  5. UVA 4857 Halloween Costumes 区间背包

    题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...

  6. sharpdevelop 调整代码字体显示大小

    SharpDevelop中使用ctrl+鼠标滚轮可以调整代码的字体显示大小

  7. 【大数据project师之路】Hadoop——MapReduce概述

    一.概述. MapReduce是一种可用于数据处理的编程模型.Hadoop能够执行由各种语言编写的MapReuce程序.MapReduce分为Map部分和Reduce部分. 二.MapReduce的机 ...

  8. 不等式数列 DP

    度度熊最近对全排列特别感兴趣,对于1到n的一个排列,度度熊发现可以在中间根据大小关系插入合适的大于和小于符号(即 '>' 和 '<' )使其成为一个合法的不等式数列.但是现在度度熊手中只有 ...

  9. Linux上ln命令详细说明及软链接和硬链接的区别

    硬链接(hard link) UNIX文件系统提供了一种将不同文件链接至同一个文件的机制,我们称这种机制为链接.它可以使得单个程序对同一文件使用不同的名字.这样的好处是文件系 统只存在一个文件的副本, ...

  10. ZOJ3261 Connections in Galaxy War —— 反向并查集

    题目链接:https://vjudge.net/problem/ZOJ-3261 In order to strengthen the defense ability, many stars in g ...