[英]IBM DB2 // Create Alias in Stored Procedure
I using the latest edition of IBM´s DB2 Express-C. 我使用的是最新版本的IBM DB2 Express-C。 In one of my stored procedures I am trying to add a CREATE ALIAS - Statement for an existing table.
在我的存储过程之一中,我试图为现有表添加CREATE ALIAS-语句。
"Unexpected token" is the error message after executing the create statement for the stored procedure. “意外的令牌”是执行存储过程的create语句后的错误消息。
So my question: I read the documentation for CREATE ALIAS . 所以我的问题是:我阅读了有关CREATE ALIAS的文档。 There is no limitation to a special context.
对特殊上下文没有限制。 Does anybody implment the CREATE ALIAS in a stored procedure successfuly?
有人成功地在存储过程中实施了CREATE ALIAS吗?
This is a snipped from my DBProc: 这是我的DBProc的片段:
DECLARE SQL varchar(450);
SET T1 = 'M2F.m2f_k' || i_TableNr;
SET T2 = 'M2F.m2f_k' || i_TableNr || '_zuodoc z' ;
-- CREATE ALIAS M2F.Kxx FOR T1;
CREATE ALIAS M2F.Kxx FOR M2F.m2f_k11;
for_loop:
FOR rs AS c1 CURSOR FOR
Thank you! 谢谢! Oliver
奥立佛
Most DDL statements, including CREATE ALIAS
, must be executed dynamically in stored procedures: 大多数DDL语句(包括
CREATE ALIAS
)必须在存储过程中动态执行:
EXECUTE IMMEDIATE 'CREATE ALIAS M2F.Kxx FOR ' || T1;
Here's a link to the manuals for the latest version of DB2 for LUW. 这是最新版本的DB2 for LUW 的手册的链接 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.