Skip to Content

STRING_AGG exceeds maximum length

Jan 23, 2017 at 02:53 PM


avatar image
Former Member


I am trying to use STRING_AGG in my sql statement. As my result set is very large, I am getting the following error.

Could not execute 'SELECT "TDNAME", LENGTH (STRING_AGG("TDLINE",'.')) as length1 FROM "schema name"."table name" GROUP BY TDNAME ...' in 3.572 seconds . SAP DBTech JDBC: [384]: string is too long: aggregated string length exceeds maximum length: 8388607 at function aggr::string_agg() (at pos 35)

I would like to only include first 8000000 in length or first 1000 rows and trim the remaining length of the string from this function.

Alternatively I need to find the length of each of the column in all the rows per group and sum it up which is a time consuming activity.

Is there any way to achieve this? Any suggestions would be very helpful

Thanks and Regards,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers