程序出错的代码:
...... EXEC SQL DECLARE goulian CURSOR FOR select a.addrreceiver,a.count,count(b.addrreceiver) from
(select addrreceiver, count(addrreceiver) as count from t20050601
where addrsender='[email protected]' group by addrreceiver) a
left join t20050601 b
on b.addrsender=a.addrreceiver
where b.addrreceiver='[email protected]'
group by a.addrreceiver,a.count; EXEC SQL OPEN goulian;
for(cnt=0;cnt<totalnum;cnt++)
......如果将中间的sql语句注释掉就编译通过(问题是单独在sql下面完全可以运行的)
否则就会报错,以下是我的操作出错信息[program@Redhat gq]$ proc PARSE=NONE t1.pcPro*C/C++: Release 10.1.0.2.0 - Production on Fri Aug 19 12:05:54 2005Copyright (c) 1982, 2004, Oracle. All rights reserved.System default option values taken from: /u01/app/oracle/product/10.1.0/db_1export/precomp/admin/pcscfg.cfgCopyright (c) 1982, 2004, Oracle. All rights reserved.System default option values taken from: /u01/app/oracle/product/10.1.0/db_1export/precomp/admin/pcscfg.cfgSyntax error at line 86, column 2, file t1.pc:
Error at line 86, column 2 in file t1.pc
left join t20050601 b
.1
PCC-S-02201, Encountered the symbol "left" when expecting one of the following: ; , for, union, connect, group, having, intersect, minus,
order, start, where, with,Syntax error at line 87, column 17, file t1.pc:
Error at line 87, column 17 in file t1.pc
on b.addrsender=a.addrreceiver
................1
PCC-S-02201, Encountered the symbol "=" when expecting one of the following: : ) [ ] / . an identifier, a numeric constant,Syntax error at line 89, column 2, file t1.pc:
Error at line 89, column 2 in file t1.pc
group by a.addrreceiver,a.count
.1
PCC-S-02201, Encountered the symbol "group" when expecting one of the following: * + - / | at, and, or, day, hour, minute, month, returning,
second, year,Syntax error at line 91, column 3, file t1.pc:
Error at line 91, column 3 in file t1.pc
//select addrreceiver, count(addrreceiver) as count from t20050601
..1
PCC-S-02201, Encountered the symbol "/" when expecting one of the following: : ( + - case, an identifier, a quoted string,
a numeric constant, cursor, date, null, count, prior, cast,
coalesce, deref, extract, interval, nullif, ref, time,
timestamp, translate, treat, trim, avg, max, min, sum,
stddev, variance,Error at line 0, column 0 in file t1.pc
PCC-F-02102, Fatal error while doing C preprocessing
[program@Redhat gq]$
...... EXEC SQL DECLARE goulian CURSOR FOR select a.addrreceiver,a.count,count(b.addrreceiver) from
(select addrreceiver, count(addrreceiver) as count from t20050601
where addrsender='[email protected]' group by addrreceiver) a
left join t20050601 b
on b.addrsender=a.addrreceiver
where b.addrreceiver='[email protected]'
group by a.addrreceiver,a.count; EXEC SQL OPEN goulian;
for(cnt=0;cnt<totalnum;cnt++)
......如果将中间的sql语句注释掉就编译通过(问题是单独在sql下面完全可以运行的)
否则就会报错,以下是我的操作出错信息[program@Redhat gq]$ proc PARSE=NONE t1.pcPro*C/C++: Release 10.1.0.2.0 - Production on Fri Aug 19 12:05:54 2005Copyright (c) 1982, 2004, Oracle. All rights reserved.System default option values taken from: /u01/app/oracle/product/10.1.0/db_1export/precomp/admin/pcscfg.cfgCopyright (c) 1982, 2004, Oracle. All rights reserved.System default option values taken from: /u01/app/oracle/product/10.1.0/db_1export/precomp/admin/pcscfg.cfgSyntax error at line 86, column 2, file t1.pc:
Error at line 86, column 2 in file t1.pc
left join t20050601 b
.1
PCC-S-02201, Encountered the symbol "left" when expecting one of the following: ; , for, union, connect, group, having, intersect, minus,
order, start, where, with,Syntax error at line 87, column 17, file t1.pc:
Error at line 87, column 17 in file t1.pc
on b.addrsender=a.addrreceiver
................1
PCC-S-02201, Encountered the symbol "=" when expecting one of the following: : ) [ ] / . an identifier, a numeric constant,Syntax error at line 89, column 2, file t1.pc:
Error at line 89, column 2 in file t1.pc
group by a.addrreceiver,a.count
.1
PCC-S-02201, Encountered the symbol "group" when expecting one of the following: * + - / | at, and, or, day, hour, minute, month, returning,
second, year,Syntax error at line 91, column 3, file t1.pc:
Error at line 91, column 3 in file t1.pc
//select addrreceiver, count(addrreceiver) as count from t20050601
..1
PCC-S-02201, Encountered the symbol "/" when expecting one of the following: : ( + - case, an identifier, a quoted string,
a numeric constant, cursor, date, null, count, prior, cast,
coalesce, deref, extract, interval, nullif, ref, time,
timestamp, translate, treat, trim, avg, max, min, sum,
stddev, variance,Error at line 0, column 0 in file t1.pc
PCC-F-02102, Fatal error while doing C preprocessing
[program@Redhat gq]$
解决方案 »
- 如果将一张表中的10万条数据导入另一张表,需要增量导入,每300条提交一次
- oracle 取随机数(涉及概率)问题
- 求SQL语句.......................................................(标题要长)
- 问个数据库设计的问题
- What statement would you issue on the preceding EMPLOYEE_TABLE to allow the MIDDLE_NAME column to accept NULL values?
- 求助: C# OracleDataReader读取数据出错,程序直接退出,无错误信息
- ORACLE客户端连接远程主机的问题
- help,我可以删掉Oracle9i客户端吗?
- alter system quiesce restricted具体的例子谁有吗?能举个例子吗?
- oracle难学吗
- 查询优化问题
- 关于trigger的问题!急
换成 WHERE A.COL=B.COL(+) 试试
你说的意思是不是不用join而换成where做,如果不用join的确没问题,
但是这和我要查询要求不符合了
(select addrreceiver, count(addrreceiver) as count from t20050601
where addrsender='[email protected]' group by addrreceiver) a
, t20050601 b
where b.addrsender=a.addrreceiver(+) and b.addrreceiver='[email protected]'
group by a.addrreceiver,a.count;
我马上试试看