当我执行以下查询时,它正在运行:
CREATE TABLE MySchema.AAA ( INFOLINKPODID NVARCHAR2(50));
但是当我尝试使用execute immediate执行相同的操作时:
EXECUTE IMMEDIATE 'CREATE TABLE '|| MySchema||'.AAA ( INFOLINKPODID NVARCHAR2(50));';
获得以下编译错误:
Error report -
ORA-06550: line 1, column 17:
PLS-00103: Encountered the symbol "CREATE TABLE " when expecting one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "CREATE TABLE " to continue.
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
提前致谢。
答案 0 :(得分:0)
根据注释,您需要一个框架块,但是还需要删除立即执行字符串末尾的分号(否则您将得到ORA-00911无效字符错误),如下所示:< / p>
begin
execute immediate 'CREATE TABLE TEST (X NUMBER)';
end;
/
应该工作。