问一句SQL
<P> EXEC SQL CREATE GLOBAL TEMPORARY TABLE temp1 AS<BR> SELECT split_id,routeflag,datarouteid<BR> FROM plt_trssplit<BR> WHERE trscode = :trancode ;<BR>为什么这句话编译不通过,直接拿到数据库执行就可以过,:trancode是一个字串型,前边定义过了 oracle<BR>错误信息:<BR>Syntax error at line 62, column 38, file traninfo.pc:<BR>Error at line 62, column 38 in file traninfo.pc<BR> EXEC SQL CREATE GLOBAL TEMPORARY TABLE temp1 AS<BR>.....................................1<BR>PCC-S-02201, Encountered the symbol "TABLE" when expecting one of the following:</P><P> ; random_terminal</P>
<P>Parser error at line 65, column 32, file traninfo.pc:<BR>Error at line 65, column 32 in file traninfo.pc<BR> WHERE trscode = :trancode ;<BR>...............................1<BR>PCC-S-02206, Host variables are not permitted within a DDL statement<BR>Syntax error at line 65, column 41, file traninfo.pc:<BR>Error at line 65, column 41 in file traninfo.pc<BR> WHERE trscode = :trancode ;<BR>........................................1<BR>PCC-S-02201, Encountered the symbol ";" when expecting one of the following:</P>
<P> table, or, random_terminal function, package, procedure,<BR> type, trigger, view, role, constraints, transaction,<BR></P> 对传给:trancode 的变量进行trim处理 不知道是不是SQL写在程序里就不支持临时表,我先建实表,然后再用insert ..select,最后再drop绕了一圈把任务完成了,不过感觉很不爽。
页:
[1]
