1.把数据中的行,转换成表数据
SELECT CAST(MULTISET (SELECT T1.COMMENTS_ID,
T2.COMMENTS_CONTENT,
T1.REVIEW_COMMENTS_TYPE
FROM REVIEW_COMMENTS T2,
PROJECT_REVIEW_COMMENTS T1
WHERE T2.COMMENTS_ID = T1.COMMENTS_ID
AND PROJECT_ID = P.PROJECT_ID
AND T1.REVIEW_COMMENTS_TYPE = 1) AS COMMENT_TABLE)
INTO V_COMMENT_TABLE
FROM PROJECTS P
WHERE P.PROJECT_ID = 901.00;
2. 查询嵌套表
INSERT INTO TEMP_REVIEW_COMMENTS
SELECT T3.COLUMN_VALUE, 3, 1
FROM PROJECTS T1, TABLE(T1.PROJECT_PREAPPROVE_REASONS) T3;
3. 更新嵌套表数据
UPDATE TABLE(SELECT t1.commodity_ad_channel_freq FROM customer_survey t1) SET COLUMN_VALUE=COLUMN_VALUE+1;
UPDATE TABLE(SELECT t1.commodity_factor FROM customer_survey t1) SET COLUMN_VALUE=COLUMN_VALUE+1;
SELECT CAST(MULTISET (SELECT T1.COMMENTS_ID,
T2.COMMENTS_CONTENT,
T1.REVIEW_COMMENTS_TYPE
FROM REVIEW_COMMENTS T2,
PROJECT_REVIEW_COMMENTS T1
WHERE T2.COMMENTS_ID = T1.COMMENTS_ID
AND PROJECT_ID = P.PROJECT_ID
AND T1.REVIEW_COMMENTS_TYPE = 1) AS COMMENT_TABLE)
INTO V_COMMENT_TABLE
FROM PROJECTS P
WHERE P.PROJECT_ID = 901.00;
2. 查询嵌套表
INSERT INTO TEMP_REVIEW_COMMENTS
SELECT T3.COLUMN_VALUE, 3, 1
FROM PROJECTS T1, TABLE(T1.PROJECT_PREAPPROVE_REASONS) T3;
3. 更新嵌套表数据
UPDATE TABLE(SELECT t1.commodity_ad_channel_freq FROM customer_survey t1) SET COLUMN_VALUE=COLUMN_VALUE+1;
UPDATE TABLE(SELECT t1.commodity_factor FROM customer_survey t1) SET COLUMN_VALUE=COLUMN_VALUE+1;