ORA-01489:字符串连接的结果太长

nav*_*vin 4 sql

ORA-01489:字符串连接的结果太长

下面的sql查询用于从数据库中提取数据作为管道分隔,并将其假脱机到unix上的文本文件

select a||'|'||b||'|'||c||'|'||d from table 
union
select a||'|'||b||'|'||c||'|'||d from table 
Run Code Online (Sandbox Code Playgroud)

有时会出现ORA错误ORA-01489:字符串连接的结果太长

如果选择超过4000限制,这看起来就像发生一样

我尝试使用to_clob,但这只适用于"union all"

有没有办法可以解决这个问题

Dav*_*sta 7

在连接之前做联合.

select to_clob(a) ||'|'|| to_clob(b) ||'|'|| to_clob(c) ||'|'|| to_clob(d) from
  (
   select a, b, c, d from table1
    union
   select a, b, c, d from table2
  )
Run Code Online (Sandbox Code Playgroud)