我们正在尝试在产品中重写SQL。 该产品将XML存储在表中,如下所示:
XML_STORAGE - UID IDENTITY - PARENT_ID INTEGER - SEQ INTEGER - XML VARCHAR(3800)
目前的做法如下:
检索PARENT_ID = n的所有ROWS。 然后遍历代码中的获取行,并在解析之前将XML字符串连接成一个大型XML。 SEQ列用于对结果进行ORDER,以便可以正确连接XML字符串。 希望这很清楚。
我们要做的是重做这个,这样我们就可以使用SQL变量来检索整个字符串,并从DB2中获取一行。 是否有一个DB2函数允许我们将所有这些行中的字符串连接成结果集中的一个大字符串。 怎么会这样的SQL看起来。 请告诉我。 任何帮助深表感谢。
谢谢! - Azeem
We are attempting to rework the SQL in a product. The product stores XML in a table as follows:
XML_STORAGE - UID IDENTITY - PARENT_ID INTEGER - SEQ INTEGER - XML VARCHAR(3800)
The current way of doing this is as follows:
Retrieve all ROWS for PARENT_ID = n. Then go over the fetched rows in the code and concatenate the XML strings into one large XML before parsing. The SEQ column is used to ORDER the result so the XML strings can be concatenated properly. Hopefully that is clear.
What we are attempting to do is rework this so we can use a SQL variant to retrieve the whole string and just fetch one row back from DB2. Is there a DB2 function that will allow us to concatenate the string in all of these rows into one large string in the resultset. How would such a SQL look. Please let me know. Any help is much appreciated.
Thanks! - Azeem
最满意答案
检查DB2中的递归查询,如此处所述
Check recursive queries in DB2, such as mentioned here
更多推荐
发布评论