一则 ORA-00923: FROM keyword not found where expected解决 原因:Select *, cast( 改成Select a.*, cast
解决 not 原因 from found SELECT where expected
2023-09-11 14:15:13 时间
原报错SQL语句:
Select *,
cast(Case When iCount=0 then 0 else (iYSYWFED*1.0)/iCount end as NUMBER(18,2)) as PerYSYWFED,
cast(Case When iCountEx=0 then 0 else (iYSYWFEDEx*1.0)/iCountEx end as NUMBER(18,2)) as PerYSYWFEDEx From (
Select e.SeqNo2, c.Area,d.TypeName,
cast(Sum(case when SUBSTR(BGRQ,1, 4)=to_char(sysdate,'yyyy') then 1 else 0 end) as Int) as iCount,
Sum(case when SUBSTR(BGRQ,1, 4)=to_char(sysdate,'yyyy') then YSYWF else 0 end) as iYSYWFED,
Sum(case when SUBSTR(BGRQ,1, 4)=cast(to_number( TO_CHAR(sysdate,'yyyy'))-1 as VARCHAR2(4)) then 1 else 0 end) as iCountEx,
Sum(case when SUBSTR(BGRQ,1, 4)=cast(to_number( TO_CHAR(sysdate,'yyyy'))-1 as VARCHAR2(4)) then YSYWF else 0 end) as iYSYWFEDEx From BB_CONTENT1 a
inner join (BB_CompanyList b inner join K_Company c on b.LoginID=c.LoginID) on a.CompanyGUID=b.GUID
inner join BB_Type d on a.TypeID=d.GUID
left join K_Area e on c.Area=e.Area2 Where bbstate='报备完成' Group By e.SeqNo2, c.Area,d.TypeName) a order by SeqNo2,TypeName
改成下面 这样OK
Select a.*,
cast(Case When iCount=0 then 0 else (iYSYWFED*1.0)/iCount end as NUMBER(18,2)) as PerYSYWFED,
cast(Case When iCountEx=0 then 0 else (iYSYWFEDEx*1.0)/iCountEx end as NUMBER(18,2)) as PerYSYWFEDEx From (
Select e.SeqNo2, c.Area,d.TypeName,
cast(Sum(case when SUBSTR(BGRQ,1, 4)=to_char(sysdate,'yyyy') then 1 else 0 end) as Int) as iCount,
Sum(case when SUBSTR(BGRQ,1, 4)=to_char(sysdate,'yyyy') then YSYWF else 0 end) as iYSYWFED,
Sum(case when SUBSTR(BGRQ,1, 4)=cast(to_number( TO_CHAR(sysdate,'yyyy'))-1 as VARCHAR2(4)) then 1 else 0 end) as iCountEx,
Sum(case when SUBSTR(BGRQ,1, 4)=cast(to_number( TO_CHAR(sysdate,'yyyy'))-1 as VARCHAR2(4)) then YSYWF else 0 end) as iYSYWFEDEx From BB_CONTENT1 a
inner join (BB_CompanyList b inner join K_Company c on b.LoginID=c.LoginID) on a.CompanyGUID=b.GUID
inner join BB_Type d on a.TypeID=d.GUID
left join K_Area e on c.Area=e.Area2 Where bbstate='报备完成' Group By e.SeqNo2, c.Area,d.TypeName) a order by SeqNo2,TypeName
Select *, 改成Select a.*, ok ,别名问题导致错误
相关文章
- ASP.NET中Cookie跨域的问题及解决代码
- Maven报错Please ensure you are using JDK 1.4 or above and not a JRE解决方法!
- 解决maven项目Cannot change version of project facet Dynamic web module to 3.0/3.1
- 解决Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.
- fisheye Error occurred during initialization of VM Could not reserve enough space for object heap 问题解决!
- ORA-12638: 身份证明检索失败的解决方法
- 佳能MP258的5200错误和P08代码解决方法及清零方法
- idea报错解决:Cannot start compilation: the output path is not specified for module “XXX“.
- MFC 解决绘图时闪烁问题的一点经验
- 解决触摸按键问题
- Android 解决CLEARTEXT communication to “ “ not permitted by network security policy
- 成功解决getaddrinfo:请求的名称有效,但是找不到请求的类型的数据。(11004
- 成功解决YOLOv3测试——could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZE作记录
- 成功解决cv2.error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion fa
- 已解决UnicodeEncodeError: ‘ascii‘ codec can‘t encode characters in position 0-1: ordinal not in range(1
- Leetcode 541. 反转字符串 II(可以,已解决)
- 完美解决 knife4j You do not have permission to access this page的问题
- 2个问题,解决tomcat启动一闪而过和运行tomcat/bin目录下的startup.bat时报错(the CATALINA_HOME environment variable is not defined correctly)
- thinkphp疑难解决4
- 解决编译.spec:rpm build with: fg: no job control报错
- Java项目打包工具安装失败解决方法
- 【大数据开发运维解决方案】记一次同事不慎用root起动weblogic以及启动日志卡在The server started in RUNNING mode 问题解决过程
- MacOS中创建Sublime Text3快捷方式返回Operation not permitted的原因及解决
- oracle 19c 创建新用户 解决ORA-65096问题
- Docker——denied: requested access to the resource is denied问题以及解决方法
- Git — 解决“requested upstream branch ‘origin/master‘ does not exist“
- 【Bug解决】UnpicklingError: A load persistent id instruction was encountered, but no persistent_load.
- 【Bug解决】Could not find resource com/kuang/mapper/Mapper.xml
- 如何5秒解决PyCharm下Django项目执行之后出现"TypeError: 'os.stat_result' object is not callable"的问题