(case when d.swjg_mc like '%1%' then '1'
when d.swjg_mc like '%2%' then '2'
when d.swjg_mc like '%3%' then '3'
when d.swjg_mc like '%4' then '4'
when d.swjg_mc like '%5%' then '5'
when d.swjg_mc like '%6%' then '6'
else '出错' end ) as xq from sb_zzs_2003_ybnsr a, sb_zzs_2003_fb2 b,dj_nsrxx c,dm_swjg d
where a.pzxh=b.pzxh and to_char(a.sssq_q,'yyyy-mm')='2008-02' and b.yxbz='Y' and b.fblc='1' and a.nsr_swjg_dm=d.swjg_dm group by d.swjg_mc) group by xq
在JSP中报错ora00905 缺少关键字 ,请各位大虾帮助看下。
17 个解决方案
#1
对了。在PL/SQL中运行正常
#2
看一下你的JSP代码
#3
我猜测是你的 SQL 语句中 加上了
例如: \n 或者是 (注释符号)“-- ” 或者其他的特殊字符,
这样SQL 打印出来是正常的 ,但是在有的数据库是不能执行通过的
例如: \n 或者是 (注释符号)“-- ” 或者其他的特殊字符,
这样SQL 打印出来是正常的 ,但是在有的数据库是不能执行通过的
#4
没有加。我把全代码发上来
#5
String sql1="select xq,sum(zse) from(select sum (distinct b.se) as zse,(case when d.swjg_mc like '%1%' then '1'when d.swjg_mc like '%2%' then '2' when d.swjg_mc like '%3%' then '3' when d.swjg_mc like '%4%' then '4'when d.swjg_mc like '%5%' then '5'when d.swjg_mc like '%6%' then '6'else '出错' end ) as xq from sb_zzs_2003_ybnsr a, sb_zzs_2003_fb2 b,dj_nsrxx c,dm_swjg d where a.pzxh=b.pzxh and to_char(a.sssq_q,'yyyy-mm-dd')='2008-02-01' and to_char(a.sssq_z,'yyyy-mm-dd')='2008-02-29' and b.yxbz='Y' and b.fblc='1' and a.nsr_swjg_dm=d.swjg_dm group by d.swjg_mc) group by xq";
ResultSet rs=st.executeQuery(sql1);
<%
while( rs.next()){%>
<TR class="TR_EVEN">
<td class="TR_ODD" height="20" width="117"> <%=(toGB(rs.getString("xq")))%></td>
ResultSet rs=st.executeQuery(sql1);
<%
while( rs.next()){%>
<TR class="TR_EVEN">
<td class="TR_ODD" height="20" width="117"> <%=(toGB(rs.getString("xq")))%></td>
#6
没人啊?别沉了哦
#7
试一下 这个吧
sql = " select xq, "
+" sum(zse) from( "
+" select sum (distinct b.se) as zse, "
+" (case when d.swjg_mc like '%1%' then '1' "
+" when d.swjg_mc like '%2%' then '2' "
+" when d.swjg_mc like '%3%' then '3' "
+" when d.swjg_mc like '%4%' then '4' "
+" when d.swjg_mc like '%5%' then '5' "
+" when d.swjg_mc like '%6%' then '6' "
+" else '出错' end ) as xq from sb_zzs_2003_ybnsr a, "
+" sb_zzs_2003_fb2 b, "
+" dj_nsrxx c, "
+" dm_swjg d "
+" where a.pzxh=b.pzxh "
+" and to_char(a.sssq_q,'yyyy-mm-dd')='2008-02-01' "
+" and to_char(a.sssq_z,'yyyy-mm-dd')='2008-02-29' "
+" and b.yxbz='Y' and b.fblc='1' "
+" and a.nsr_swjg_dm=d.swjg_dm "
+" group by d.swjg_mc "
+" ) group by xq "
#8
楼上的代码暂时不行。呼唤高人啊,奇怪问题
#9
你是不是该空格的地方没空格啊。。。。。
#10
完全复制粘贴,在PLSQL中都能通过
#11
javax.servlet.ServletException: ORA-00905: ?????
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.lzs.lzszyfp_005fsql_jsp._jspService(lzszyfp_005fsql_jsp.java:250)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
出错信息
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.lzs.lzszyfp_005fsql_jsp._jspService(lzszyfp_005fsql_jsp.java:250)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
出错信息
#12
javax.servlet.ServletException: ORA-00905: ?????
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.lzs.lzszyfp_005fsql_jsp._jspService(lzszyfp_005fsql_jsp.java:250)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
出错信息
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.lzs.lzszyfp_005fsql_jsp._jspService(lzszyfp_005fsql_jsp.java:250)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
出错信息
#13
帮顶!
对了 你其他的SQL语句都能正常执行吧
#14
都可以
#15
问题已经解决了?
是什么问题?
难道是,''号没写对?
#16
还没有解决呢.知识没上来看.求高人
#17
测试了哈,取掉(case when d.swjg_mc like '%1%' then '1'
when d.swjg_mc like '%2%' then '2'
when d.swjg_mc like '%3%' then '3'
when d.swjg_mc like '%4' then '4'
when d.swjg_mc like '%5%' then '5'
when d.swjg_mc like '%6%' then '6'
else '出错' end )
替换成 d.swhg_mc 可以正常运行。怀疑是不是<%@page import=java.sql.*%> 不支持case
when d.swjg_mc like '%2%' then '2'
when d.swjg_mc like '%3%' then '3'
when d.swjg_mc like '%4' then '4'
when d.swjg_mc like '%5%' then '5'
when d.swjg_mc like '%6%' then '6'
else '出错' end )
替换成 d.swhg_mc 可以正常运行。怀疑是不是<%@page import=java.sql.*%> 不支持case
#1
对了。在PL/SQL中运行正常
#2
看一下你的JSP代码
#3
我猜测是你的 SQL 语句中 加上了
例如: \n 或者是 (注释符号)“-- ” 或者其他的特殊字符,
这样SQL 打印出来是正常的 ,但是在有的数据库是不能执行通过的
例如: \n 或者是 (注释符号)“-- ” 或者其他的特殊字符,
这样SQL 打印出来是正常的 ,但是在有的数据库是不能执行通过的
#4
没有加。我把全代码发上来
#5
String sql1="select xq,sum(zse) from(select sum (distinct b.se) as zse,(case when d.swjg_mc like '%1%' then '1'when d.swjg_mc like '%2%' then '2' when d.swjg_mc like '%3%' then '3' when d.swjg_mc like '%4%' then '4'when d.swjg_mc like '%5%' then '5'when d.swjg_mc like '%6%' then '6'else '出错' end ) as xq from sb_zzs_2003_ybnsr a, sb_zzs_2003_fb2 b,dj_nsrxx c,dm_swjg d where a.pzxh=b.pzxh and to_char(a.sssq_q,'yyyy-mm-dd')='2008-02-01' and to_char(a.sssq_z,'yyyy-mm-dd')='2008-02-29' and b.yxbz='Y' and b.fblc='1' and a.nsr_swjg_dm=d.swjg_dm group by d.swjg_mc) group by xq";
ResultSet rs=st.executeQuery(sql1);
<%
while( rs.next()){%>
<TR class="TR_EVEN">
<td class="TR_ODD" height="20" width="117"> <%=(toGB(rs.getString("xq")))%></td>
ResultSet rs=st.executeQuery(sql1);
<%
while( rs.next()){%>
<TR class="TR_EVEN">
<td class="TR_ODD" height="20" width="117"> <%=(toGB(rs.getString("xq")))%></td>
#6
没人啊?别沉了哦
#7
试一下 这个吧
sql = " select xq, "
+" sum(zse) from( "
+" select sum (distinct b.se) as zse, "
+" (case when d.swjg_mc like '%1%' then '1' "
+" when d.swjg_mc like '%2%' then '2' "
+" when d.swjg_mc like '%3%' then '3' "
+" when d.swjg_mc like '%4%' then '4' "
+" when d.swjg_mc like '%5%' then '5' "
+" when d.swjg_mc like '%6%' then '6' "
+" else '出错' end ) as xq from sb_zzs_2003_ybnsr a, "
+" sb_zzs_2003_fb2 b, "
+" dj_nsrxx c, "
+" dm_swjg d "
+" where a.pzxh=b.pzxh "
+" and to_char(a.sssq_q,'yyyy-mm-dd')='2008-02-01' "
+" and to_char(a.sssq_z,'yyyy-mm-dd')='2008-02-29' "
+" and b.yxbz='Y' and b.fblc='1' "
+" and a.nsr_swjg_dm=d.swjg_dm "
+" group by d.swjg_mc "
+" ) group by xq "
#8
楼上的代码暂时不行。呼唤高人啊,奇怪问题
#9
你是不是该空格的地方没空格啊。。。。。
#10
完全复制粘贴,在PLSQL中都能通过
#11
javax.servlet.ServletException: ORA-00905: ?????
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.lzs.lzszyfp_005fsql_jsp._jspService(lzszyfp_005fsql_jsp.java:250)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
出错信息
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.lzs.lzszyfp_005fsql_jsp._jspService(lzszyfp_005fsql_jsp.java:250)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
出错信息
#12
javax.servlet.ServletException: ORA-00905: ?????
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.lzs.lzszyfp_005fsql_jsp._jspService(lzszyfp_005fsql_jsp.java:250)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
出错信息
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.lzs.lzszyfp_005fsql_jsp._jspService(lzszyfp_005fsql_jsp.java:250)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
出错信息
#13
帮顶!
对了 你其他的SQL语句都能正常执行吧
#14
都可以
#15
问题已经解决了?
是什么问题?
难道是,''号没写对?
#16
还没有解决呢.知识没上来看.求高人
#17
测试了哈,取掉(case when d.swjg_mc like '%1%' then '1'
when d.swjg_mc like '%2%' then '2'
when d.swjg_mc like '%3%' then '3'
when d.swjg_mc like '%4' then '4'
when d.swjg_mc like '%5%' then '5'
when d.swjg_mc like '%6%' then '6'
else '出错' end )
替换成 d.swhg_mc 可以正常运行。怀疑是不是<%@page import=java.sql.*%> 不支持case
when d.swjg_mc like '%2%' then '2'
when d.swjg_mc like '%3%' then '3'
when d.swjg_mc like '%4' then '4'
when d.swjg_mc like '%5%' then '5'
when d.swjg_mc like '%6%' then '6'
else '出错' end )
替换成 d.swhg_mc 可以正常运行。怀疑是不是<%@page import=java.sql.*%> 不支持case