oracle未找到要求的from关键字,什么问题?

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Ideality_hunter/article/details/77572019

oracle未找到要求的from关键字,什么问题?


问题还原:

select t.money as 经济收入/万 from salary t 

select t.money as 经济收入(万) from salary t 

select t.money as 经济收入[万] from salary t 


以上都会报错:“oracle未找到要求的from关键字”。


原因是,经济收入/万、经济收入(万)、经济收入[万] ,有特殊字符,所以报错。

怎么解决呢?

双引号,将其引住。



展开阅读全文
博主设置当前文章不允许评论。

错误信息(923:ORA-00923: 未找到要求FROM 关键字

08-06

这是sql语句rn"SELECT A.GROUP_NO,\n" + rn" A.QTY_DATE,\n" + rn" A.SEQ_ID,\n" + rn" A.INNER_NO,\n" + rn" A.SINGLE_BATTERY_NUM,\n" + rn" A.MADE_DATE,\n" + rn" A.LOT_NO,\n" + rn" A.ASSET_NO,\n" + rn" A.PRODUCT_NO,\n" + rn" A.MADE_NO,\n" + rn" A.PR_ORG,\n" + rn" A.FIRST_RUN_DATE,\n" + rn" A.LAST_RUN_DATE,\n" + rn" A.LAST_REPAIR_DATE,\n" + rn" A.CHIP_FACTORY,\n" + rn" A.BATTERY_SHAPE,\n" + rn" A.CHIP_GROUP_TYPE,\n" + rn" (SELECT ORG_NAME FROM O_ORG WHERE ORG_NO = A.PR_ORG) PR_ORG_NAME,\n" + rn" A.BELONG_DEPT,\n" + rn" A.EQIP_PRC,\n" + rn" N + A.PR_CODE,\n" + rn" A.CUR_STATUS_CODE,\n" + rn" A.DOC_CREATOR_NO,\n" + rn" SUBS_ID,\n" + rn" (SELECT SUBS_NO FROM C_SUBS WHERE SUBS_ID = A.SUBS_ID) SUBS_NO,\n" + rn" + (SELECT USER_NAME N +\n" + rn" FROM P_SYS_USER N +\n" + rn" WHERE SYS_USER_NAME = A.DOC_CREATOR_NO) DOC_CREATOR_NAME,\n" + rn" A.DOC_CREATE_DATE,\n" + rn" N + A.REMARK,\n" + rn" A.BATTERY_ID,\n" + rn" A.GROUP_TYPE,\n" + rn" A.BATTERY_TYPE,\n" + rn" A.BATTERY_MODEL,\n" + rn" A.BATTERY_CAPA,\n" + rn" N + A.BATTERY_SPEC,\n" + rn" A.RUN_DATE,\n" + rn" A.MANUFACTURER,\n" + rn" A.MOBILE,\n" + rn" A.VALIDATE_CODE,\n" + rn" A.BAR_CODE,\n" + rn" A.WH_ID,\n" + rn" EQUIP_CODE_ID,\n" + rn" N +\n" + rn" ((SELECT B.NAME FROM D_WH B WHERE B.WH_ID = A.WH_ID) || N +\n" + rn" DECODE((SELECT B.NAME FROM D_WH_AREA B WHERE B.ID = A.WH_AREA_ID),\n" + rn" '',\n" + rn" '',\n" + rn" ('>>' ||\n" + rn" (SELECT B.NAME FROM D_WH_AREA B WHERE B.ID = A.WH_AREA_ID))) || N +\n" + rn" DECODE((SELECT B.STORE_AREA_NAME\n" + rn" FROM D_STORAGE_AREA B\n" + rn" WHERE B.ID = A.STORE_AREA_ID),\n" + rn" '',\n" + rn" '',\n" + rn" ('>>' || (SELECT B.STORE_AREA_NAME\n" + rn" FROM D_STORAGE_AREA B\n" + rn" WHERE B.ID = A.STORE_AREA_ID))) || N +\n" + rn" DECODE((SELECT B.NAME\n" + rn" FROM D_STOCK_POS B\n" + rn" WHERE B.STORE_LOC_ID = A.STORE_LOC_ID),\n" + rn" '',\n" + rn" '',\n" + rn" ('>>' || (SELECT B.NAME\n" + rn" FROM D_STOCK_POS B\n" + rn" WHERE B.STORE_LOC_ID = A.STORE_LOC_ID)))) LOCATION_INFO +\n" + rn" FROM D_BATTERY A N +\n" + rn" WHERE A.ASSET_NO = ?;";rn 论坛

ORA-00923: 未找到预期 FROM 关键字 的问题,求助

02-15

代码如下:rnpublic List getForumMainList(final long bid, final int firstResult, final int maxResults) rn return getHibernateTemplate().executeFind(new HibernateCallback() rn public Object doInHibernate(Session s) throws HibernateException, SQLException rn String q = "from Forum" + SysUtil.getForumTableID(bid) +rn " forum where forum.boardID = ? and forum.isNew = 1 and forum.delSign = 0 and forum.auditing = 0 order by forum.isTop desc,forum.lastTime desc";rn Query query = s.createQuery(q);rn query.setLong(0, bid);rn query.setFirstResult(firstResult);rn query.setMaxResults(maxResults);rn List list = query.list();rn return list;rnrn rn rn );rn rnrnrn错误信息rn2007-02-15 14:13:58,859 [org.springframework.jdbc.support.SQLStateSQLExceptionTranslator]-[INFO] Translating SQLException with SQLState '42000' and errorCode '923' and message [ORA-00923: 未找到预期 FROM 关键字rn]; SQL was [null] for task [HibernateAccessor]rn2007-02-15 14:13:58,875 [org.apache.struts.action.RequestProcessor]-[WARN] Unhandled Exception thrown: class org.springframework.jdbc.BadSqlGrammarExceptionrn2007-02-15 14:13:58,875 [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bbs]]-[INFO] Bad SQL grammar [null] in task 'HibernateAccessor'; nested exception is java.sql.SQLException: ORA-00923: 未找到预期 FROM 关键字rnrnrn请问是什么问题,明天还有一天了就要完成,急啊,帮忙啊各位 论坛

ORA-00923: 未找到预期 FROM 关键字 求解答 谢谢!

08-07

String sql= "select code,name,nvl(h,0) h,nvl(z,0) z,nvl(c,0) c,nvl(abs(cont-(h+z+c)/items),0) wtp,"rn + "nvl(case when cont*items=0 then 0 else round((h*100)/(cont*items),2) end,0) ypl from "rn + "(with c as (select count(*) items from t_asse_pro_struct s where s.pro_id = (select pro_id from t_asse_oject_troupe_middle t "rn + "where t.asse_status='1' and t.asse_type='1' group by pro_id)) "rn + "select b.code,b.name,nvl(sum(a.inner_h),0) h,nvl(sum(a.inner_z),0) z,nvl(sum(a.inner_c),0) c,c.items,"rn + "(select count(*) from a01 where a0132 like f_del_char(b.code)||'#' and a0199<'5') cont "rn + "from (select max(a1.troupe_code) troupe_code,sum(a1.inner_h+b1.asse_scale) inner_h,sum(a1.inner_z) inner_z,sum(a1.inner_c) inner_c from"rn +"t_asse_troupe_statis a1,(select t.*,s.id s_id,s.pro_type,s.status from t_asse_troupe_list t,t_asse_usual_times s where t.pro_id=s.pro_id and"rn +"substr(to_char(t.asse_date,'yyyy-MM-dd'),1,7)=s.asse_date and s.asse_date='2013-08')b1 where a1.pro_id=b1.pro_id) a,"rn + "(select t.* from t_asse_troupe t,t_asse_oject_troupe_middle o where t.code=o.dw_code "rn + "and o.asse_status='1' and o.asse_type='1' and instr(o.asse_range,'4')>0 %s) b,c "rn + "where a.troupe_code(+)=b.code group by b.code,b.name,c.items) "rn + "order by ypl desc,z desc,c desc,wtp desc";rnrnif (troupe_type != null && !"".equals(troupe_type)) rn if ("under".equals(troupe_type)) rn sql = String.format(sql, "and t.type='1'");rn else if ("subarea".equals(troupe_type)) rn sql = String.format(sql, "and t.type in ('2','3')");rn else if ("county".equals(troupe_type)) rn sql = String.format(sql, "and t.type='4'");rn rn else rn sql = String.format(sql, "and 1=1");rn rn运行程序就出现了 ORA-00923: 未找到预期 FROM 关键字rn但是将sql语句拿到数据库去执行,又能成功 论坛

没有更多推荐了,返回首页