整理自: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.