导出数据时,在SQL拼接处,提示 oracle ORA-01704: string literal too long

sql:

 WITH already_in AS
 (SELECT distinct REGEXP_SUBSTR('-999,CX201702210003,CX201702270003,……,CX201702270004', '[^,]+', 1, level) col   from dual
  connect by level <= length(regexp_replace(''-999,CX201702210003,CX201702270003,……,CX201702270004',  '[^,]*')) + 1)
select pro.*, u.user_name PROJECT_MANAGER_NAME
  from cp_p pro  left join cdc_u u    on u.user_id = pro.PROJECT_MANAGER
 where 1 = 1   and exists (select * from already_in al where al.col = pro.project_code)
   AND pro.project_manager not in (select info.user_id  from cdc_user_info info  where info.user_name in ('fff'))
 
拼接的字符串超长导致“string” 抛异常。减少了拼接字符后,顺利执行。
注意:在拼接sql时,用于某类型字段的拼接,需要注意其长度。事先预测一下需要拼接的字符最长会达到多少,超长的话可以使用clob类型字段。
尽量避免拼接超长字符用在sql中,如必须,可以声明一个事务变量,或者分页处理(或分段连接处理)。
 
网上有相关处理方式,引用一下:

有两种方法可以解决:

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

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

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

update mall_config set category_info='安全防护:3003,' where id=1;

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直接insert update一个表时,出现ORA-01704: string literal too long的错误,我们的sql是 update mall_config ...

  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. 使用code::blocks搭建objective-c的IDE开发环境 支持 @interface

    网上有许多的关于 <使用code::blocks搭建objective-c的IDE开发环境>的文章. 大多是写了一个Helloworld 就结束了,今天试了试 添加了一个 @interfa ...

  2. Linux进程状态转换图

    Linux进程状态 Linux内核中的进程状态 ◆运行状态(TASK_RUNNING) 指正在被CPU运行或者就绪的状态.这样的进程被成为runnning进程.运行态的进程可以分为3种情况:内核运行态 ...

  3. 微信小程序3 - 对象的合并

    ES6中 Object.assign方法用于对象的合并,将源对象( source )的所有可枚举属性,复制到目标对象( target ). 限制:   只是浅拷贝, 即 内部对象 不会拷贝,只是 引用 ...

  4. C++ 类的多态二(函数重载--函数重写--函数重定义)

    //函数重载--函数重写--函数重定义 #include<iostream> using namespace std; /* 函数重载: 必须在一个类中进行(子类无法重载父类中的函数) 子 ...

  5. Temporal Ensembling for Semi-Supervised Learning

    Laine, Samuli, and Timo Aila. "Temporal Ensembling for Semi-Supervised Learning." arXiv pr ...

  6. 读取Properties文件六种方法

    1.使用java.util.Properties类的load()方法 示例: InputStream in = lnew BufferedInputStream(new FileInputStream ...

  7. linux 内核经典面试题

    http://blog.chinaunix.net/uid-25909619-id-3376158.html

  8. HTML5 选择前置摄像头,选择后置摄像头

    最近发现我写的都是乱七八糟的,觉得应该给大家带点福利,于是写了这篇 背景:最近想做个web应用,需要用到摄像头,但是发现默认一直是前置摄像头,拍照很麻烦,于是找了很多文章,居然没有人提到,只好FQ去找 ...

  9. windows 下安装securecrt 绿色版

  10. 【Raspberry Pi】定时运行python程序读温湿度传感器数据&发邮件

    1.定时执行脚本 http://tech.it168.com/a2011/0707/1214/000001214830_all.shtml /sbin/service crond start //启动 ...