- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
创建了一个 View ,其中一个字段(共 6 个)是源表中两个字段的串联。创建了第二个 View ,它使用 listagg 来组合串联的结果。正确使用这两个步骤操作会返回源表中两个字段的 listagg 连接。
当我尝试创建一个既能产生串联又能产生 listagg 的 View 时,我收到 Oracle 错误 ora-01489 字符串串联结果太长。
作为测试,我选择了 max(length(concatenated field) 并返回 837。因此,看来所述错误是错误的。
所以它必须在语法中。我尝试过 rtrim、trim 甚至 substr,但无法获取 View 语句来编译 listagg(concatenation) 和返回数据。
我能够开发正确返回数据的两个 View ,这表明我已经了解了基本语法,但我无法弄清楚将串联与 listagg 函数相结合的任务。
在另一种情况下,我能够在一个语句中将串联与 listagg 函数结合起来:
LISTAGG (STATEMENTS || ' - ' || BIRTH_DATE, '; ')
WITHIN GROUP (ORDER BY STATEMENTS || ' - ' || BIRTH_DATE)
AS GROWING_UP
此语法正确返回所需的数据.........
但在上述情况下,类似的语法会产生 Ora-01489 错误。
知道有时 Oracle 错误可能会产生误导,我想知道是否有任何专家可能知道除 Oracle 可能抛出此错误之外的任何原因?
LISTAGG ((NUMBER || '-' || text), ',') WITHIN GROUP (ORDER BY (NUMBER || '-' || text))
AS
restrictions FROM source
返回错误
最佳答案
您超出了 4000 字节的 SQL 限制,该限制也适用于 LISTAGG
。
SQL> SELECT listagg(text, ',') WITHIN GROUP (
2 ORDER BY NULL)
3 FROM
4 (SELECT to_char(to_date(level,'j'), 'jsp') text FROM dual CONNECT BY LEVEL < 250
5 )
6 /
SELECT listagg(text, ',') WITHIN GROUP (
*
ERROR at line 1:
ORA-01489: result of string concatenation is too long
作为解决方法,您可以使用XMLAGG。
例如,
SQL> SET LONG 2000000
SQL> SET pagesize 50000
SQL> SELECT rtrim(xmlagg(XMLELEMENT(e,text,',').EXTRACT('//text()')
2 ).GetClobVal(),',') very_long_text
3 FROM
4 (SELECT to_char(to_date(level,'j'), 'jsp') text FROM dual CONNECT BY LEVEL < 250
5 )
6 /
VERY_LONG_TEXT
--------------------------------------------------------------------------------
one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen
,fifteen,sixteen,seventeen,eighteen,nineteen,twenty,twenty-one,twenty-two,twenty
-three,twenty-four,twenty-five,twenty-six,twenty-seven,twenty-eight,twenty-nine,
thirty,thirty-one,thirty-two,thirty-three,thirty-four,thirty-five,thirty-six,thi
rty-seven,thirty-eight,thirty-nine,forty,forty-one,forty-two,forty-three,forty-f
our,forty-five,forty-six,forty-seven,forty-eight,forty-nine,fifty,fifty-one,fift
y-two,fifty-three,fifty-four,fifty-five,fifty-six,fifty-seven,fifty-eight,fifty-
nine,sixty,sixty-one,sixty-two,sixty-three,sixty-four,sixty-five,sixty-six,sixty
-seven,sixty-eight,sixty-nine,seventy,seventy-one,seventy-two,seventy-three,seve
nty-four,seventy-five,seventy-six,seventy-seven,seventy-eight,seventy-nine,eight
y,eighty-one,eighty-two,eighty-three,eighty-four,eighty-five,eighty-six,eighty-s
even,eighty-eight,eighty-nine,ninety,ninety-one,ninety-two,ninety-three,ninety-f
our,ninety-five,ninety-six,ninety-seven,ninety-eight,ninety-nine,one hundred,one
hundred one,one hundred two,one hundred three,one hundred four,one hundred five
,one hundred six,one hundred seven,one hundred eight,one hundred nine,one hundre
d ten,one hundred eleven,one hundred twelve,one hundred thirteen,one hundred fou
rteen,one hundred fifteen,one hundred sixteen,one hundred seventeen,one hundred
eighteen,one hundred nineteen,one hundred twenty,one hundred twenty-one,one hund
red twenty-two,one hundred twenty-three,one hundred twenty-four,one hundred twen
ty-five,one hundred twenty-six,one hundred twenty-seven,one hundred twenty-eight
,one hundred twenty-nine,one hundred thirty,one hundred thirty-one,one hundred t
hirty-two,one hundred thirty-three,one hundred thirty-four,one hundred thirty-fi
ve,one hundred thirty-six,one hundred thirty-seven,one hundred thirty-eight,one
hundred thirty-nine,one hundred forty,one hundred forty-one,one hundred forty-tw
o,one hundred forty-three,one hundred forty-four,one hundred forty-five,one hund
red forty-six,one hundred forty-seven,one hundred forty-eight,one hundred forty-
nine,one hundred fifty,one hundred fifty-one,one hundred fifty-two,one hundred f
ifty-three,one hundred fifty-four,one hundred fifty-five,one hundred fifty-six,o
ne hundred fifty-seven,one hundred fifty-eight,one hundred fifty-nine,one hundre
d sixty,one hundred sixty-one,one hundred sixty-two,one hundred sixty-three,one
hundred sixty-four,one hundred sixty-five,one hundred sixty-six,one hundred sixt
y-seven,one hundred sixty-eight,one hundred sixty-nine,one hundred seventy,one h
undred seventy-one,one hundred seventy-two,one hundred seventy-three,one hundred
seventy-four,one hundred seventy-five,one hundred seventy-six,one hundred seven
ty-seven,one hundred seventy-eight,one hundred seventy-nine,one hundred eighty,o
ne hundred eighty-one,one hundred eighty-two,one hundred eighty-three,one hundre
d eighty-four,one hundred eighty-five,one hundred eighty-six,one hundred eighty-
seven,one hundred eighty-eight,one hundred eighty-nine,one hundred ninety,one hu
ndred ninety-one,one hundred ninety-two,one hundred ninety-three,one hundred nin
ety-four,one hundred ninety-five,one hundred ninety-six,one hundred ninety-seven
,one hundred ninety-eight,one hundred ninety-nine,two hundred,two hundred one,tw
o hundred two,two hundred three,two hundred four,two hundred five,two hundred si
x,two hundred seven,two hundred eight,two hundred nine,two hundred ten,two hundr
ed eleven,two hundred twelve,two hundred thirteen,two hundred fourteen,two hundr
ed fifteen,two hundred sixteen,two hundred seventeen,two hundred eighteen,two hu
ndred nineteen,two hundred twenty,two hundred twenty-one,two hundred twenty-two,
two hundred twenty-three,two hundred twenty-four,two hundred twenty-five,two hun
dred twenty-six,two hundred twenty-seven,two hundred twenty-eight,two hundred tw
enty-nine,two hundred thirty,two hundred thirty-one,two hundred thirty-two,two h
undred thirty-three,two hundred thirty-four,two hundred thirty-five,two hundred
thirty-six,two hundred thirty-seven,two hundred thirty-eight,two hundred thirty-
nine,two hundred forty,two hundred forty-one,two hundred forty-two,two hundred f
orty-three,two hundred forty-four,two hundred forty-five,two hundred forty-six,t
wo hundred forty-seven,two hundred forty-eight,two hundred forty-nine
<小时/>
如果您想要连接多个本身具有4000 字节的列,那么您可以连接每列的 XMLAGG 输出以避免 4000 字节的 SQL 限制。
例如,
WITH DATA AS
( SELECT 1 id, rpad('a1',4000,'*') col1, rpad('b1',4000,'*') col2 FROM dual
UNION
SELECT 2 id, rpad('a2',4000,'*') col1, rpad('b2',4000,'*') col2 FROM dual
)
SELECT ID,
rtrim(xmlagg(XMLELEMENT(e,col1,',').EXTRACT('//text()') ).GetClobVal(), ',')
||
rtrim(xmlagg(XMLELEMENT(e,col2,',').EXTRACT('//text()') ).GetClobVal(), ',')
AS very_long_text
FROM DATA
GROUP BY ID
ORDER BY ID;
关于sql - 甲骨文-ORA-01489 : result of string concatenation is too long,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29776035/
在OOCalc中,我想使用CONCATENATE函数为A列中的每个字符串添加引号。 所以在单元格 B1 中我想做: =CONCATENATE("\"",A1,"\"") OOCalc 不喜欢这样,或者
我对此进行了编码,当我运行它时,它向我显示一条消息,变量“Number”与其余串联“大于5”之间的“+”中存在问题 这是代码 fun main(args: Array) { print("En
我正在尝试连接多个 dask 数据帧,但这会导致我的所有 RAM 都用完并使我的环境 (Google Colab) 崩溃。 我曾尝试与 Dask 连接,因为我听说 Dask 会对文件进行分区,以便更容
常规语言在串联下是封闭的 - 这可以通过使一种语言的接受状态以 epsilon 过渡到下一种语言的开始状态来证明。 如果我们考虑语言 L = {a^n | n >=0},这种语言是正则的(就是一个*)
有什么方法可以跨多行使用 | 字符串运算符? 使用经典的 CONCATENATE 标记,您可以进行如下分配: CONCATENATE 'A rubber duck is a toy shaped li
我有一个表单,其中包含许多格式为 name="field-1" name="field-2" name="field-3" name="field-4" 等等.... 在表单操作页面上,我希望能够使用
我们如何连接动态工作区的字段?这个想法在下面的代码中: LOOP AT lt_final INTO DATA(ls_final). CONCATENATE ls_final-field1
我需要将符号从 4 位数字扩展到 32 位数字。 我尝试像这样重复 MSB 28 次: assign x={28'b{a[3]},a[3:0]}; 但是,我得到一个错误: Syntax error n
我的数据如下所示: ColumnName PrimaryKey 1 ID Y 2 JOB_NAME N 3 JOB_DES
我试图用 Perl6 连接一个字符串,因此: my $cmd = "databricks jobs --job-id 37 --notebook-params '\{"; put $cmd; $cmd
我是 verilog 的初学者。 几乎所有的连接示例如下。 wire [3:0] result; reg a, b, c, d; result = {a, b, c, d}; 以下也可以吗? wir
我正在尝试在 VHDL 上实现它: a<=(b+c)/16; 这个我试过了,但是synthesis不接受。 signal b,c : std_logic_vector(7 downto 0); s
我很难理解 Verilog 中的以下语法: input [15:0] a; // 16-bit input output [31:0] result; // 32-bit output a
假设我有一个占位符 ph_input = tf.placeholder(dtype=tf.int32, [无, 1]) 和一个向量 h = tf.zeros([1,2], dtype=tf.int32
假设我有 ceylon 字符串列表。 (不一定是 List ;它可以是可迭代对象、序列、数组等)将所有这些字符串连接成一个字符串的最佳方法是什么? 最佳答案 最有效的解决方案是使用静态方法String
这个问题已经有答案了: Why does Java's concat() method not do anything? (6 个回答) 已关闭 8 年前。 我找到了这段代码 public class
似乎预处理器在连接有符号数字的 token 时添加了一个空格。 我试过这个: #define DECL_FL(IE) 1e##IE##f float val[] = { DECL_FL(12)
我正在实现一个基于作者的图书搜索功能。我应该返回一个查询结果,其中包含查询作者撰写的所有书籍。但是,对某些作者姓名的查询可能会返回多个结果(例如,查询“Smith, W”可能会匹配“Smith, We
我正在尝试将多个单元格添加在一起,并且在它们之间,我需要一个 IF 公式。我基本上是根据我拥有的列表制作 HTML 输出,我需要检查列中是否有“事件”或“终止”,并根据该列表选择要使用的 html 类
通常,当您链接到另一个单元格时,您会返回该单元格的内容。 我想做的是这样的: =HYPERLINK(CONCATENATE("=C:/documents/'[",B15,".xls]Sheet 1'!
我是一名优秀的程序员,十分优秀!