我想从预先创建的DGTT中返回内容作为表函数的结果集。
但是当我引用它时,我得到了SQL SQL 0526 N/ SQLSTATE 42995错误。
我看不出为什么。Documentation只显示42995 sqlstate错误的3个原因:
Restrictions on the use of declared temporary tables: Declared temporary tables cannot:
- Be specified in an ALTER, COMMENT, GRANT, LOCK, RENAME or REVOKE statement (SQLSTATE 42995).
- Be referenced in an AUDIT, CREATE ALIAS, or CREATE VIEW statement (SQLSTATE 42995).
- Be specified in referential constraints (SQLSTATE 42995).
但是它们都没有被使用..函数非常简单:
BEGIN ATOMIC
CALL DBAREP.SP_ROW_CHECKSUM(sSchema, sTable, sColumnList, sWhere, iRows) ;
RETURN
(SELECT * FROM SESSION.DBAREP_ROW_CHECKSUM ) ;
END@
我这次违反了什么规则?
1条答案
按热度按时间a1o7rhls1#
文档中确实没有明确说明,但是
Declared
GTT不能用在内联的复合语句中(带有开始ATOMIC ... END)。您可以改为在内联复合语句中使用
Created
GTT。