学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

问一句SQL

问一句SQL

EXEC SQL CREATE GLOBAL TEMPORARY TABLE temp1 AS
SELECT split_id,routeflag,datarouteid
FROM plt_trssplit
WHERE trscode = :trancode ;
为什么这句话编译不通过,直接拿到数据库执行就可以过,:trancode是一个字串型,前边定义过了 oracle
错误信息:
Syntax error at line 62, column 38, file traninfo.pc:
Error at line 62, column 38 in file traninfo.pc
EXEC SQL CREATE GLOBAL TEMPORARY TABLE temp1 AS
.....................................1
PCC-S-02201, Encountered the symbol "TABLE" when expecting one of the following:

; random_terminal

Parser error at line 65, column 32, file traninfo.pc:
Error at line 65, column 32 in file traninfo.pc
WHERE trscode = :trancode ;
...............................1
PCC-S-02206, Host variables are not permitted within a DDL statement
Syntax error at line 65, column 41, file traninfo.pc:
Error at line 65, column 41 in file traninfo.pc
WHERE trscode = :trancode ;
........................................1
PCC-S-02201, Encountered the symbol ";" when expecting one of the following:

table, or, random_terminal function, package, procedure,
type, trigger, view, role, constraints, transaction,

TOP

对传给:trancode 的变量进行trim处理
迎着太阳的朝阳我们喝着咖啡

TOP

不知道是不是SQL写在程序里就不支持临时表,我先建实表,然后再用insert ..select,最后再drop绕了一圈把任务完成了,不过感觉很不爽。

TOP

发新话题