在DB2中执行如下SQL脚本时发生错误“规范 ORDER BY 或 FETCH FIRST n ROWS ONLY 无效”,
CREATE OR REPLACE VIEW AS
SELECT
*
FROM
(( SELECT
SORT_INDEX,
ID
FROM
A_TABLE
)
UNION
ALL ( SELECT
SORT_INDEX,
ID
FROM
B_TABLE
)
)
ORDER BY
SORT_INDEX
修改方法: order by 改到子查询中,添加外层查询select * from (…)。