整理自:http://forums.oracle.com/forums/thread.jspa?threadID=664180&tstart=0
问:Is it possible to use INNER JOIN's with Pro*C? I'm currently getting this error:
INNER JOIN t_diagnosis b ON a.sak_diag = b.sak_diag
....1
PCC-S-02201, Encountered the symbol "INNER" when expecting one of the following:
; , for, union, connect, group, having, intersect, minus,
order, start, where, with,
The query runs fine via SQL Developer. My version of Pro*C is Pro*C/C++: Release 10.2.0.3.0.
Thanks,
Matthew
答:
Unfortunately the Pro*C precompiler does not understand "new" syntax/keywords... this falls into the same category as using analytics discussed here:
http://forums.oracle.com/forums/thread.jspa?threadID=664180&tstart=0
You would need to use dynamic sql as described in the programmer's guide to do this.
Support for all the ANSI 99 sql syntax (including joins) has been added in 11g w ith the new precompiler option common_parser. You can precompile your proc program containig join sqls as follows:
proc common_parser=yes proc_file.pc
For release 10.2 and earlier you would to workaround by using dynamic sqls as Mark suggested.
本文解答了关于使用 Pro*C 进行 SQL 编写时遇到的问题,特别是 INNER JOIN 的限制。由于 Pro*C 预编译器不支持新的 SQL 语法特性,包括 INNER JOIN,因此建议使用动态 SQL 或升级到支持新语法的版本。
2106

被折叠的 条评论
为什么被折叠?



