重赏!ORACLE的有关GROUP BY的语句为何老报错,求高手指教

CREATE TABLE SUIJI518 AS SELECT S2,S3,S4,S5,S6,S7,S1,S8 FROM SUIJI18 Group by S2,S3,S4,S5,S6,S7,S1
以上是我的SQL语句,执行后ORACLE报错:
错误报告:
ORA-00979: 不是 GROUP BY 表达式
ORA-06512: 在 "DBSNMP.ZHONGZHUANDAORU", line 48
ORA-06512: 在 line 20
00979. 00000 - "not a GROUP BY expression"
*Cause:

*Action:
求高手指教是怎么回事!

0

13个回答

你这表复制不是这样玩的, 你select了多少个字段,后面group by就得是相同的字段

-2

SELECT S2,S3,S4,S5,S6,S7,S1,S8 FROM SUIJI18 Group by S2,S3,S4,S5,S6,S7,S1
这句中字段S8出现在SELECT段但没有出现在GROUP BY段,只能出现在聚合函数中,比如换成MAX(S8)

2

group by要配合聚合函数使用,如sum,count,max等,你那语句group by 后面只到了s7,语句里面有s8需要处理

1

报错:不是单组分组函数

如果程序中使用了分组函数,则有两种情况可以使用:
1 程序中存在group by,并指定了分组条件,这样可以将分组条件一起查询出来
2 如果不使用分组的活,则只能单独使用分组函数,在使用分组函数的时候,不能出现分组条件之外的字段

二、

当使用分组函数时,分组函数只能出现在选择列表、order by 和 having 子句中,而不能出现在 where 和 group by 子句中。另外,使用分组函数还有以下一些注意事项:

1、  当使用分组函数时,除了函数 count(*) 之外,其他分组函数都会忽略 null 行,当然 count(列名) 也会忽略 null 行。

2、  当执行 select 语句时,如果选择列表时包含列、表达式和分组函数,那么这些列和表达式必须出现在 group by 子句中。

3、  当使用分组函数时,在分组函数中可以指定 all 和 distinct 选项。其中 all 是默认选项,该选项表示统计所有行数据(包括重复行);如果指定 distinct,则只会统计不同行值。

4、  Having 是在 group by 语句之后。

三、

group by 用于对查询结果进行分组统计,而 having 子句则用于限制分组显示结果。注意,如果在选择列表中同时包含列、表达式和分组函数,那么这些列和表达式必须出现在 group by 子句中。

四、

使用 group by 子句、where 子句和分组函数有以下一些注意事项:

1、分组函数只能出现在选择列表、having 子句和 order by 子句中

2、如果在select 语句中同时包含 group by 、having 以及 order by 子句,则必须将 order by 子句放在最后。默认情况下,当使用 group by 子句统计数组时,会自动按照分组列的升序显示统计结果。通过使用 order by 子句,可以改变数据分组的排序方式。

3、如果选择列表包含有列、表达式和分组函数,那么这些列和表达式必须出现在 group by 子句中,否则会显示错误消息。

4、当限制分组显示结果时,必须要使用 having 子句,而不能在 where 子句中使用分组函数限制显示结果,否则会显示错误信息。
1

查询的字段和group by 的字段必须一致

CREATE TABLE SUIJI518 AS
    SELECT  S2 ,
            S3 ,
            S4 ,
            S5 ,
            S6 ,
            S7 ,
            S1 ,
            S8
    FROM    SUIJI18
    GROUP BY S2 ,
            S3 ,
            S4 ,
            S5 ,
            S6 ,
            S7 ,
            S1 ,
            S8
1

Group by只能跟在select后边,你这语法不对吧。

1

s8这个字段没放上去

1

CREATE TABLE是创建表啊,怎么后面还有GROUP BY

0
0
0
共13条数据 1 尾页
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
oracle 语句,有关group by 的
[code=SQL]rnselect kdjc_get_ip_cou3(dslam_ip,1,null,null,null,null,null,null,40) from kdlc_devicejc_result rn group by dslam_iprn[/code]rnrn我还想要一起查询出别的字段,(有基本字段,也有用函数取得的字段),且我只想group by dslam_ip(按这一个来group by)rnrn我该怎么办?rnrn先这么查出来,再用个连接查其它的字段?rn还有别的方法么!! rnrn谢谢
求SQL语句,有关group by 的
表arnid item gyname rn1 china 小红rn2 china 小李rn3 usa 张三rn4 ity 程盗rn5 ity 葛冰rnrn我想要得到这要一个SQL结果表:rnitem gs gyname rnchina 2 小红 小李rnusa 1 张三rnity 2 程盗 葛冰rnrn我现在的SQL select item,count(item) as gs, ?? from 表a group by itemrnrn各位来帮我看看.
求一Sql语句(有关group by)
[b]Table1[/b]rnuserID version scorern1 1.0 2rn1 2.0 3rn1 3.0 4rn2 2.0 1rn2 4.0 3rnrn求所有USERID 的最大version对应的Scorernrn要求最后获得的是rn1 3.0 4rn2 4.0 3rnrn
求条SQL语句,有关GROUP BY的~~~
SELECT DISTINCT YXSM AS '院系所码', count(yxsm) AS '报名人数' FROM KSXX WHERE KSFSM='11'GROUP BY YXSM" --正常显示rnrn我想在院系所码后加一字段,'院系名称',该怎么写rn另一表:ZSZY(YXSM, YXMC)rn
求ORACLE代码?有关COUNT、GROUP BY、ORDER BY
表VISITORrnVISITORID RAW(32)rnCLASSCODE RAW(32)rn表CODECLASSrnCLASSCODE RAW(32)rnCLASSNAME VARCHAR2(32)rnSERIALNUMBER NUMBER(3,0)rnrn要求:rn1-按照CLASSCODE进行GROUP BYrn2-用COUNT统计VISITORIDrn3-按照SERIALNUMBER进行ORDER BYrn4-SELECT内容为CODECLASS.CLASSNAME, COUNT(VISITOR.VISITORID)rnrn敬请指教rn
求一SQL语句,有关group by的问题
主键rn id fidrn 1 18rn 2 17rn 3 19rn 4 17rn 5 18rn 6 19rn 7 17rnrn想得到:rn 3 19rn 5 18rn 7 17rn也就是分组查询出所有fid相同的记录,并按id升序排列各个分组得到最后一条(每个分组只要一条记录)
不知为何报错,请高手指教!
error: Invalid class file format: c:\j2sdk1.4.1_02\lib\rt.jar(javax/swing/JFrame.class).rnwrong version:48 ,expected 45rnBoxWindow.java:9:Superclass javax.swing.JFrame of class BoxWindow not found.rnpublic class BoxWindow extends JFrame(rnrn2 errorsrnrn不知为何报错,请高手指教!rn如果是版本问题,那么rd.jar在哪获得才是正确的版本呢?我用的是jre文件夹下的rnrt.jar。
为何以下代码不报错, 求指教。
class CTestrnpublic:rnchar m_cText[20];rnrnrnint main()rnrnCTest *p = NULL;rnprintf("%s\n", p->m_cText);rnreturn 0;rn
oracle语句报错求指正
SELECT * FROM ( SELECT A.NAV_TYPE,A.KEY#ROWID_OBJECT,A.KEY#ROWID_OBJECT,ROWNUM RN rn FROM (SELECT NAV_TYPE,ROWID_OBJECT as KEY#ROWID_OBJECT,ROWID_OBJECT as KEY#ROWID_OBJECT rn FROM C_BO_TH_NAVIGATION WHERE 1=1) as A WHERE ROWNUM <= 1) WHERE RN >= 15
sql语句,求高手指教
表A 里面有 name,id 两列他们的对应关系如下是多对多 ,很混乱rnname idrn张三 1rn张三 3rn张三 2rn李四 2rn李四 1rn王五 1rn王五 3rn王五 6rnrn我现在要用表A里面的name和id ,张三。李四。王五 各取一组数据出来 ID随便配一个对应的就行rn如rn张三,3rn李四,2rn王五,6rnsql语句该如何写,求教了~rnrn
菜鸟求oracle高手指教
从来没有用过oracle软件,现在刚刚下载了一个oracle 10.g 不知道如何使用,求教育。
重赏高手!
我从网络上搜集了大量关于CRC32的计算,可没有一个能正确计算出我想要的结果,我不知道到底我错在哪里,故将代码传上来,请高手指点!rn鄙人无以回报,只能许诺将自己完全自主开发并已销售在百宝箱上线的游戏完整原代码(KJava的代码,与C语言语法相似,得此代码您将可以轻松地编写出同种类型游戏)真诚地奉献给您!rnrn我整理的代码如下:rn// crc3.cpp : Defines the entry point for the console application.rn//rnrn#include "stdafx.h"rnrn#include rn//--------------------------------------------------------------------------- rn//算法四rnstatic unsigned long crc32_table4[256]; // Lookup table arrayrnstatic unsigned long Reflect(unsigned long ref, char ch)rnrn // Used only by Init_CRC32_Table().rnrn unsigned long value = 0;rnrn // Swap bit 0 for bit 7rn // bit 1 for bit 6, etc.rn int i;rn for(i = 1; i < (ch + 1); i++)rn rn if(ref & 1)rn value |= 1 << (ch - i);rn ref >>= 1;rn rn return value;rnrnrnvoid Init_CRC32_Table()rnrn // Call this function only once to initialize the CRC table.rnrn // This is the official polynomial used by CRC-32rn // in PKZip, WinZip and Ethernet.rn unsigned long ulPolynomial = 0x04c11db7;rnrn // 256 values representing ASCII character codes.rn int i, j;rn for(i = 0; i <= 0xFF; i++)rn rn crc32_table4[i] = Reflect(i, 8) << 24;rn for (j = 0; j < 8; j++)rn crc32_table4[i] = (crc32_table4[i] << 1) ^ (crc32_table4[i] & (1UL << 31) ? ulPolynomial : 0);rn crc32_table4[i] = Reflect(crc32_table4[i], 32);rn rnrnrnunsigned long Get_CRC32(unsigned char *pdata, int len)rnrn // Pass a text string to this function and it will return the CRC.rnrn // Once the lookup table has been filled in by the two functions above,rn // this function creates all CRCs using only the lookup table.rnrn // Be sure to use unsigned variables,rn // because negative values introduce high bitsrn // where zero bits are required. rnrn // Start out with all bits set high. rn unsigned long ulCRC = 0xffffffff;rnrn // Perform the algorithm on each characterrn // in the string, using the lookup table values.rn while(len--)rn ulCRC = (ulCRC >> 8) ^ crc32_table4[(ulCRC & 0xFF) ^ (unsigned char)(*pdata++)];rn // Exclusive OR the result with the beginning value. rn return ulCRC ^ 0xffffffff;rnrn//---------------------------------------------------------------------------
老题目,求指教
typedef union rnrn long i; rn int k[5]; rn char c;rn DATE;rnrnstruct data rn rnint cat; rnDATE cow; rndouble dog;rn too; rnDATE max; rnrnrn void main()rn rn printf("%d\n",sizeof(struct data)+sizeof(max));rn rnrn1.值是52 rn2.那么我们把union 里面的int k[5] 改成char k[5];rn理论值 和vc计算值一样吗?
求一条group语句
有三个部门,A,B,C,工资都放在salary表里,现在我想得到每个部门工资最多的前5个和最少的后5人的信息,用一条可以做到吗?rnsalary 表结构:EmployeeID,salary_money,Dept
求sql group by 语句
select a,b,sum(d) from a group by a,b;rnrn现在需要该成rnrnselect …… rnrngroup by arnrn就是最后只想对a进行分组。b不需要分组。这语句需要怎么改呢!
为何top语句报错
select top 10 id from table1 ;rnrnERROR 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10 id from table1' at line 1rnrnselect id from table1 ;能查 加上top就不行了
这条语句为何报错
signtime 为串字段 数据如'20070801123418'rnrnSELECT CAST(LEFT(SignTime, 4) & '-' & SUBSTRING(SignTime, 4, 2) rn & '-' & SUBSTRING(SignTime, 6, 2) & substring(signtime,8,2) & substring(signtime,10,2) & substring(12,2) AS datetime) AS Expr1rnFROM dbo.jxt_dataupld
求一个group by 语句
表:rn[code=SQL]CREATE TABLE bbbb (id int(11) NOT NULL,class varchar(50) NOT NULL);[/code]rnid classrn1 7,4rn2 7,2,6rn3 1,2rn4 2,4rn5 6rn6 6,10rn7 1,6rn8 2rn数据:rn[code=SQL]insert into bbbb rnvalues (1,'7,4'),(2,'7,2,6'),(3,'1,2'),(4,'2,4'),(5,'6'),(6,'6,10'),(7,'1,6'),(8,'2');[/code]rnrn想得到的结果是:rnclass count(*)rn1 2 --1出现2次rn2 4 --2出现4次rn4 2 ...rn6 4 rn7 2rn10 1rn就是对class列的值分出来并且进行统计.(感觉就是原表就是被group_concat()函数得来的结果,现在想得到的是被group_concat()之前的class列的统计)
GROUP BY 语句。高手帮忙!
SELECT T_USERS.USERNAME AS 医生姓名,T_OFFICE.OFFICE AS 科室,T_REGISTER_INFO.REGISTERID AS 挂号号,T_PATIENT_INFO.PATIENTNAME AS 病人姓名,rnT_REGISTER_INFO.REGISTERFEE AS 挂号费,T_REGISTER_INFO.EXAMINEMONEY AS 诊金,T_OPERATOR.OPERATORNAME AS 操作员,T_REGISTER_INFO.OPERATEDATE rnAS 操作时间,T_REGISTER_INFO.CANCELMARK AS 退费标识 rnFROMrnT_OFFICE,T_PATIENT_INFO,T_USERS,T_REGISTER_INFO,T_OPERATORrnWHERErnT_USERS.OfficeID=T_OFFICE.OfficeIDrnAND T_REGISTER_INFO.DoctorID=T_USERS.UserIDrnAND T_REGISTER_INFO.DiagnoseID=T_PATIENT_INFO.DiagnoseID rnAND T_REGISTER_INFO.OperatorID=T_OPERATOR.OperatorIDrnAND T_REGISTER_INFO.CANCELMARK=0rnGROUP BYrnT_REGISTER_INFO.OPERATEDATErn--------------------------------------rn按照T_REGISTER_INFO.OPERATEDATE分组,这个是时间格式,有重复的值,要显示不同表里的个别字段,就是上面要显示的字段rn要过滤掉重复的T_REGISTER_INFO.OPERATEDATE字段的值。SQL语句完整的应该怎么写。帮忙!
求GROUP BY 的简单语句!
我想把NAME库中的人名作统计,看都有谁,因为NAME字段中有重复人名(也就是重复记录),所以要分组统计,但总是出错!rnselect name from name group by namernid name add_timern1 A 19:3:45rn2 B 19:4:45rn3 A 19:5:45rn4 C 19:6:45rn5 A 19:7:45rn6 B 19:8:45rn得出的结果是:A B C
求一个GROUP 语句
表 Arn列 AA BBrn cc ddrn cc ccrn ee ffrn ff eern rn要求这样输出(把列AA,BB的两列数据输出一列分组)rn列 CCrn ccrn ddrn eern ffrnrn
求帮助 老报错
class Childrn rnint putAppleNum;//对象属性 每个小 孩放的苹果数量rnstatic int eatAppleNum;//类属性 小孩一共吃的苹果rn//对象行为 无返回值rnvoid eatApple(Basket basket,int appleNum)rn basket.appleNum=basket.appleNum-appleNum;rn Child.eatAppleNum=Child.eatAppleNum+appleNum;rnrnvoid putApple(Basket basket,int appleNum)rn basket.appleNum=basket.appleNum+appleNum; //放苹果的行为 rn this.putAppleNum=this.putAppleNum+appleNum;//当前小孩放的数量变化rn rnrn class Applern rnrn class Basketrn int appleNum;rnrnrnrnclass TestApplernrnrnrnpublic static void main(String[] args)rn rn Child c1 = new Child();//创建小孩一rn Child c2 = new Child();rn Basket b1 = new Basket();rn Basket b2 = new Basket();rn c1.putApple(b1,5);rn c1.putApple(b2,3);rn c2.putApple(b2,6);rn c1.eatApple(b2,2);rn c2.eatApple(b1,4);rn System.out.println("c1 putAppleNum"+c1.putAppleNum);rn System.out.println("c2 putAppleNum"+c1.putAppleNum);rn rn System.out.println("b1 appleNum"+b1.appleNum);rn System.out.println("b2 appleNum"+b2.appleNum);rn rn System.out.println("Child eatAppleNum"+Child.eatAppleNum);rn rnrn rn rn
以下语句为何报错?RA-00979: not a GROUP BY expression
以下语句正常得到结果:rn SELECT a.sljg,b.jgmc,substr(a.tdj,1,4) ,C.XSJMC ,count(1)rn rn FROM TYJMX a,TJGB b,TXSJMCYB crn WHERE a.sljg=b.jgbh and C.YB=substr(a.tdj,1,4)rn and a.sljg='31003800' and substr(a.tdj,1,4)<>'3100'rn and a.yjzt<>'Z' and substr(a.pc,1,2)<>'CS'rn group by a.sljg,b.jgmc,substr(a.tdj,1,4) ,C.XSJMCrn ;rnrn 但是: SELECT a.sljg,b.jgmc,substr(a.tdj,1,4) ,C.XSJMC ,count(1) ,rn (SELECT COUNT(*)rn FROM tyjmx drn WHERE d.sljg = a.sljg and d.tdj=a.TDJ rn and d.sljg='31003800' and substr(d.tdj,1,4)<>'3100'rn AND d.yjzl = 'B类邮件' ) rn rn FROM TYJMX a,TJGB b,TXSJMCYB crn WHERE a.sljg=b.jgbh and C.YB=substr(a.tdj,1,4)rn and a.sljg='31003800' and substr(a.tdj,1,4)<>'3100'rn and a.yjzt<>'Z' and substr(a.pc,1,2)<>'CS'rn group by a.sljg,b.jgmc,substr(a.tdj,1,4) ,C.XSJMCrn ;rnrn却报错:RA-00979: not a GROUP BY expression rn其中d.yjzl = 'B类邮件' ) 是邮件种类中的一部分rnoracle10g是支持这种写法的,求助
求Sql语句!求高手指教
有一个表内容table1如下:rncol1 col2rn1 arfg,sik,wetg,ggg,gsd,greg,rn2 gjdfbd,s,ewof,ewe,rn3 dsgg,ggg,o32,2,sds,ty,ww,rn4 dstr,54f,00,ws,ggg,wsr,gwdsd,rnrncol2中为逗号分隔的一系列值,个数不定rnrn我现在希望找出col2中含有ggg的行rnrn谢谢了
oracle 10g, 自定义类型报错求指教
SQL:rnCREATE OR REPLACE TYPE Type_Address AS OBJECT(Street CHAR(50),State CHAR(20),City CHAR(20),Zip CHAR(10) ); ->ok!rncreate table TT( ID INTEGER, ADDRESS Type_Address) ; ->OK!rnINSERT INTO TT VALUES(1,Type_Address('1316 WEST 35TH ','CA','LOS ANGELES','90007')); -> ok!rnrnSelect ID from TT 正常返回值 rnrnSelect * from TT / Select ADDRESS from TT 报错:错误提示为:rnrn ORA-00932: 数据类型不一致: 应为 NUMBER, 但却获得 USER.TYPE_ADDRESSrnrn求指教!!!
oracle 登录报错 ORA-01034: ORA-27101 求指教!!!
说明一下,我是windows环境,我的服务全部都能启动。rnrn出这两个错误,我还在网上查了下,已经确定不是ORACLE_SID和ORACLE_HOME 的问题了,检查过没改变,并且昨天还用的好好的,今天突然就出了这个问题,不可能是修改了ORACLE_SID和ORACLE_HOME。rnrn使用lsnrctl start服务也能启动。rnrn用pl/sql登录的时候报这个错,而且我发现一个现象,往常我打开服务的时候,CPU占用的内存马上会增加900M左右(一开始创建这个实例的时候,就是给的900),但是现在启动这些服务速度超级快,一点启动,进度条就马上读完了,然后看看CPU,没变!还是跟没开数据库一样,我有点怀疑自己是不是丢失了文件,或者是那个服务根本就坏了,虽然显示了“已启动”,但后台还是没启动。rnrn已经是第二次碰到这个问题了,第一次因为里面的数据不多,直接卸载了数据库重装了;现在如果再重装,就会丢失很多东西了。rnrnrn求高人指教!rnrn有不有什么可行办法。
请高手指教!有关SQL语句的问题。
假如表1中有A,B,C三个字段,表2中有A,D两个字段,表1中字段A有重复值,表2中A唯一,我想实现这样的查询结果:rn A B C Drn 11 aa bb ccrn 11 a2 b2 ccrn下面的语句的结果和我想要差别很大:rn select 表1.A,表1.B,表1.C,表2.D from 表1,表2rn where 表1.A=表2.Arn group by 表1.Arn having count(*)>1;rn结果显示如下:rn A B C Drn 11 aa bb ccrn 11 aa bb c1rn 11 aa bb c2rn .rn .rn请高手指点迷津。谢谢先!!!
Oracle Group by语句和递归查询总结
一、Group By Rollup的使用方法 1、概念    在Group By 中使用Rollup产生常规分组汇总行以及分组小计:  2、举例   SELECT department_id ,job_id ,SUM(salary) FROM employees WHERE department_id &amp;lt; 60 GROUP BY ROLLUP(d...
急求查询语句 group by有关!
表aa rnid m_id mrn1 01 arn2 01 brn3 02 crn4 01 drn5 02 ern6 02 frn我想要的结果是:按照m_id分组后的第一条数据,即:rn1 01 arn3 02 crn分组后的第二条数据呢?rn2 01 brn5 02 ern先行谢过!
有关sql语句报错
消息 103,级别 15,状态 4,过程 Sp_COPD_SaleProductAnalysis_V,第 105 行rn以 ' Insert Into #tmp_FilterFg(fFgCode,fDevproperty,fVFg) rn Select fFgCode ,fDevproperty,fcorrespondcode rn From t_COPM_F' 开头的 标识符 太长。最大长度为 128。rnrnrnrn请问哪位高手知道,怎样快速查询sql报错?谢谢!
linux2.6.35 i2c驱动报错 求高手指教
最近在学习i2c驱动,我用的内核是2.6.35 飞思卡尔的平台,但是看了好多资料上的驱动在我的linux内核下都无法编译过去rn 出现这个错误,我要编的是at2408的驱动,在网上找的对应于2.6.32的驱动,不知道是不是版本问题,新手求指点rn drivers/char/at2408.c: In function 'at24c08_read':rndrivers/char/at2408.c:25: warning: ignoring return value of 'copy_from_user', declared with attribute warn_unused_resultrndrivers/char/at2408.c:39: warning: ignoring return value of 'copy_to_user', declared with attribute warn_unused_resultrndrivers/char/at2408.c: In function 'at24c08_write':rndrivers/char/at2408.c:51: warning: ignoring return value of 'copy_from_user', declared with attribute warn_unused_resultrndrivers/char/at2408.c: At top level:rndrivers/char/at2408.c:109: error: variable 'addr_data' has initializer but incomplete typerndrivers/char/at2408.c:110: error: unknown field 'normal_i2c' specified in initializerrndrivers/char/at2408.c:110: warning: excess elements in struct initializerrndrivers/char/at2408.c:110: warning: (near initialization for 'addr_data')rndrivers/char/at2408.c:111: error: unknown field 'probe' specified in initializerrndrivers/char/at2408.c:111: warning: excess elements in struct initializerrndrivers/char/at2408.c:111: warning: (near initialization for 'addr_data')rndrivers/char/at2408.c:112: error: unknown field 'ignore' specified in initializerrndrivers/char/at2408.c:112: warning: excess elements in struct initializerrndrivers/char/at2408.c:112: warning: (near initialization for 'addr_data')rndrivers/char/at2408.c:121: warning: initialization from incompatible pointer typerndrivers/char/at2408.c:122: error: unknown field 'address_data' specified in initializerrndrivers/char/at2408.c:122: warning: initialization from incompatible pointer typernrn最主要的似乎是这个地址结构体的error: variable 'addr_data' has initializer but incomplete type出现错误rnrnrnrn
linux下的bison报错,求高手指教!急
想用flex+bison写个简单的编译器,生成三地址中间代码。结果bison的编译就一堆警告。。。大概是说定义的文法没有用之类的。rnrn这个是flex文件rn[code=c]rn%option noyywrap nodefault yylinenornrn%rn#include "compiler.h"rn#include "parsing.tab.h"rn%rnrn%%rn"+" |rn"-" |rn"*" |rn"/" |rn"=" |rn";" |rn"(" |rn")" | rn"" |rn"" return yytext[0];rnrn">" yylval.cmp = 1; return CMP; rn"<" yylval.cmp = 2; return CMP; rn"!=" yylval.cmp = 3; return CMP; rn"==" yylval.cmp = 4; return CMP; rn">=" yylval.cmp = 5; return CMP; rn"<=" yylval.cmp = 6; return CMP; rnrn"if" return IF; rn"else" return ELSE; rn"while" return WHILE; rn"do" return DO; rn"break" return BREAK;rnrn"&&" return AND;rn"||" return OR;rnrn"int" yylval.type=1; return TYPE;rn"float" yylval.type=2; return TYPE;rn"bool" yylval.type=3; return TYPE;rnrn[0-9]+ yylval.i=atoi(yytext); return INTEGER;rn[0-9]+"."[0-9]* yylval.d=atof(yytext); return FLOAT;rn"true" |rn"false" yylval.b=strdup(yytext); return BOOLEAN;rnrn[a-zA-Z][a-zA-Z0-9]* yylval.s = lookup(yytext); return ID; rnrn"//".*rn[ \t\n]rnrn. yyerror("error input %c\n",*yytext);rn%%rnrn[/code]rnrnrn这个是bison文件,所有的警告都在这里rn[code=c]rnrn%rn#include rn#include rn#include "compiler.h"rn%rnrn%unionrn struct ast *a;rnrn double d; rn int i;rn char * b;rnrn struct symbol *s;rnrn int cmp;rn int type;rnrnrnrn%token INTEGER rn%token FLOAT rn%token BOOLEANrn%token IDrn%token EOLrnrn%token IF ELSE WHILE DO BREAKrn%token AND ORrnrn%token TYPErnrn%nonassoc CMPrn%right '='rn%left '+' '-'rn%left '*' '/'rnrn%type block rn%type decls decl typern%type stmts stmt loc bool rn%type join equality expr term unary factorrnrn%start calclistrnrn%%rnrnblock: '' decls stmts '' $$=$3;rn;rnrndecls: decls decl rn;rndecl: type ID ';' rn;rntype: type '[' INTEGER ']'rn | TYPE $$=newast('X',S1,NULL);rn;rnrnstmts: stmts stmt $$=newast('C',$1,$2);rn;rnstmt: loc '=' bool ';' $$=newast('=',$1,$3);rn | IF '(' bool ')' stmt $$=newflow('I',$3,$5,NULL);rn | IF '(' bool ')' stmt ELSE stmt $$=newflow('I',$3,$5,$7); rn | WHILE '(' bool ')' stmt $$=newflow('W',$3,$5,NULL);rn | DO stmt WHILE '(' bool ')' ';' $$=newflow('D',$5,$2,NULL);rn | BREAK ';' $$=newast('B',NULL,NULL);rn | block rn;rnrnloc: loc '[' bool ']' $$=newast('[',$1,$3);rn | ID $$=newref($1);rn;rnbool: bool OR join $$=newast('|',$1,$3);rn | joinrn;rnjoin: join AND equality $$=newast('&',$1,$3);rn | equalityrn;rnequality: equality CMP expr $$=newcmp($2,$1,$3);rn | exprrn;rnexpr: expr '+' term $$=newast('+',$1,$3);rn | expr '-' term $$=newast('-',$1,$3);rn | termrn;rnterm: term '*' unary $$=newast('*',$1,$3);rn | term '/' unary $$=newast('/',$1,$3);rn | unaryrn;rnunary: '!' unary $$=newast('!',$2,NULL);rn | '-' unary $$=newast('M',$2,NULL);rn | factorrn;rnfactor: '(' bool ')' $$=$2;rn | locrn | INTEGER $$=newint($1);rn | FLOAT $$=newflo($1);rn | BOOLEAN $$=newbol($1);rn;rnrncalclist:rn | calclist block EOL $2;printf("end\n");rn;rn%%rn[/code]rnrnrn警告大概如下:rnparsing.y: 警告: 14 nonterminals useless in grammarrnparsing.y: 警告: 36 rules useless in grammarrnparsing.y:38.11-15: 警告: nonterminal useless in grammar: blockrn...(省略)rnparsing.y:47.8-41: 警告: rule useless in grammar: block: '' decls stmts ''rn...(省略)rnrn求高手分析上面定义的文法是否不可以用在bison中,还是我哪里写错了。。。
求高手指教这个报错是怎么回事?
2011-4-7 0:36:23 org.apache.catalina.core.AprLifecycleListener initrn信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_16\bin;D:\apache-tomcat-6.0.16\binrn2011-4-7 0:36:23 org.apache.coyote.http11.Http11Protocol initrn信息: Initializing Coyote HTTP/1.1 on http-8080rn2011-4-7 0:36:23 org.apache.catalina.startup.Catalina loadrn信息: Initialization processed in 586 msrn2011-4-7 0:36:23 org.apache.catalina.core.StandardService startrn信息: Starting service Catalinarn2011-4-7 0:36:23 org.apache.catalina.core.StandardEngine startrn信息: Starting Servlet Engine: Apache Tomcat/6.0.16rn2011-4-7 0:36:24 org.apache.catalina.core.StandardContext addApplicationListenerrn信息: The listener "listeners.ContextListener" is already configured for this context. The duplicate definition has been ignored.rn2011-4-7 0:36:24 org.apache.catalina.core.StandardContext addApplicationListenerrn信息: The listener "listeners.SessionListener" is already configured for this context. The duplicate definition has been ignored.rn2011-4-7 0:36:24 org.apache.catalina.core.ApplicationContext logrn信息: ContextListener: contextInitialized()rn2011-4-7 0:36:24 org.apache.catalina.core.ApplicationContext logrn信息: SessionListener: contextInitialized()rnservlet3 init()rnservlet2 init()rn2011-4-7 0:36:25 org.apache.coyote.http11.Http11Protocol startrn信息: Starting Coyote HTTP/1.1 on http-8080rn2011-4-7 0:36:25 org.apache.jk.common.ChannelSocket initrn信息: JK: ajp13 listening on /0.0.0.0:8009rn2011-4-7 0:36:25 org.apache.jk.server.JkMain startrn信息: Jk running ID=0 time=0/47 config=nullrn2011-4-7 0:36:25 org.apache.catalina.startup.Catalina startrn信息: Server startup in 1739 msrn2011-4-7 0:36:57 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet Servlet10 threw exceptionrnjava.lang.NullPointerExceptionrn at java.util.Properties$LineReader.readLine(Properties.java:418)rn at java.util.Properties.load0(Properties.java:337)rn at java.util.Properties.load(Properties.java:325)rn at cn.itcast.servlet.Servlet10.doGet(Servlet10.java:30)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rn2011-4-7 0:38:35 org.apache.catalina.startup.HostConfig checkResourcesrn信息: Reloading context [/day05]rnservlet3 init()rnservlet2 init()
VS2010 启动就报错,求高手指教!!!!!!!!!!
VS2010 开始是闪退,我卸载重装后,现在启动就报错,不知道什么原因?rn[img=https://img-bbs.csdn.net/upload/201403/14/1394776584_702581.jpg][/img]
Eclipse奇怪报错 求高手指教
我在ECLIPSE中集成EXPRESSOrn原来是可以的 但不知道怎么搞了一下 就不行了rn报错rn1。TOMCAT 不能运行rn2。ANT 的时候rnException occurred during launchrnReason:rnCounld not run the external toolrn"The variable named 'workspace_loc' for the file location does not exist"rn怎么有个变量不见了 ???rn3.DEBUG的时候rnException occurred during launchrnReason :rnCannot ;ocate JRE defintion:"jdk1.4".launch abortedrn
maven 使用报错,求高手指教一二
plugin execution not covered by lifecyle configuration:org.apache.manven.pluginrnrn在工程里的maven配置文件中,每个pom.xml都有上面的错误,以前没有用过maven,请问这是什么原因?
关于Oracle 8i的SQL语句的问题?求高手指教
小弟用的数据库是oracle 8i的rn没办法,老系统还得维护rnrn现在我在sql/plus里面写一条SQL语句,select top 10 * from studentrn结果告诉我语句错误rn是不是8I的SQL语句不支持TOP这样的关键字啊rnrn要是我想选前10位的记录该怎么写啊 rnrn求达人指教rnrn谢谢
使用GROUP by 报错,简单问题,请指教!
select * from #zgszjy1 group by secuidrn列 '#zgszjy1.custname' 在选择列表中无效,因为该列既不包含在聚合函数中,也不包含在 GROUP BY 子句中。rn使用表#zgszjy1中字段secuid做group by时报上面错位!是什么原因?
求大侠指教:update语句的小问题(ORACLE)
我有两个表结构一样(tid,tname,tinfo) 的数据表t1,t2rn其中t2是数据信息完全的,我想将每条t2的tname信息更新到t1表对应的记录中rn请问如何用一条update语句实现,谢谢!我在mysql下用这个rn能实现:update t1, t2 set t1.tname= t2.tname where t1.tid=t2.tid
extjs报错,求指教
[code=Java]<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"rn pageEncoding="UTF-8"%>rnrnrn rn 数据列表rn