在oracle端能执行的sql语句 却在java端不能执行
select To_Char((To_Date('19700101','yyyymmdd') + A.Submit_Date/86400 +To_Number(Substr(Tz_Offset(Sessiontimezone),1,3))/24),'YYYY-MM')date1,count(A.incident_number)num1,
count(B.incident_number)num2,
count(B.incident_number)/count(A.incident_number) percentage
from
(
select distinct hhd.incident_number,(case when hhd.status=0 then '新建' when hhd.status=1 then '已指派' when hhd.status=2 then '进行中' when hhd.status=3 then '待决' when hhd.status=4 then '已解决' when hhd.status=5 then '已关闭' when hhd.status=6 then '已取消' end)status ,
hhd.Assigned_Group ,hhd.assignee, hhd.Submit_Date,hhd.key,
(case when hhd.Phone_Number is not null and hhd.Description is not null and hhd.Reported_Source is not null and hhd.Detailed_Decription is not null
and hhd.impact is not null and hhd.Urgency is not null and Priority is not null and hhd.Service_Type is not null and hhd.Estimated_Resolution_Date is not null AND hhd.Assigned_Group is not null
and hhd.Assignee is not null and hhd.Product_Categorization_Tier_1 is not null
then 'Y' else 'N' end )ful,
(case when( hhd.service_type=1 and hwl.number_of_attachments =1 and hhd.Priority not in (0,1) ) or
(hhd.service_type=0 and hhd.Priority in (0,1) and hwl.number_of_attachments >1) then 'Y' when hhd.service_type=1 and hwl.number_of_attachments <1 then 'N' else '-' end )worklog,
(case when hhd.priority<=1 and csg.FUNCTIONAL_ROLE like '%Incident Manager%' then 'Y'
when hhd.priority<=1 and csg.FUNCTIONAL_ROLE not like '%Incident Manager%' then 'N' else '-' end )FUNCTIONAL_ROLE,
(case when hhd.status >=3 and hhd.Resolution is not null then 'Y' when hhd.status >=3 and hhd.Resolution is null then 'N' else '-' end)Resolution,
(case when ( hhd.Priority in (0,1) and hhd.status >=4 and hhd.service_type<>1 and hwl.number_of_attachments =1 ) or
(Priority in (0,1) and hhd.service_type=1 and hhd.status >=4 and hwl.number_of_attachments >1 ) then 'Y'
when ( hhd.Priority in (0,1) and hhd.service_type<>1 and hhd.status >=4 and ( hwl.number_of_attachments is null or hwl.number_of_attachments <1) )or
(hhd.Priority in (0,1) and hhd.service_type=1 and hhd.status >=4 and ( hwl.number_of_attachments is null or hwl.number_of_attachments <2 ) ) then 'N' else '-' end) critical,
(case when hhd.status >=5 and hhd.status_reason is not null then 'Y' when hhd.status >=5 and hhd.status_reason is null then 'N' else '-' end)status_reason
from (Select h.*,c.key From Hpd_Help_Desk h,HASCO_report_companyManpping c where h.company=c.value ) hhd
left join
(select distinct incident_number,z2af_work_log01,number_of_attachments from HPD_WORKLOG where z2af_work_log01 is not null and number_of_attachments is not null )hwl
on hhd.incident_number=hwl.incident_number
left join
( (select login_id ,ltrim( max(sys_connect_by_path(FUNCTIONAL_ROLE,'/')),'/')as FUNCTIONAL_ROLE from
( select login_id,FUNCTIONAL_ROLE ,
rank()over(order by login_id)+row_number()over(order by login_id )RN,row_number()over(partition by login_id order by login_id )RM from CTM_SUPPORTGROUPFUNCTIONALROLE ) start with RM=1 connect by prior RN=RN-1
group by login_id )) csg
on hhd.ASSIGNEE_LOGIN_ID=csg.login_id ) A
left join
(select distinct incident_number from (
select distinct hhd.incident_number,(case when hhd.status=0 then '新建' when hhd.status=1 then '已指派' when hhd.status=2 then '进行中' when hhd.status=3 then '待决' when hhd.status=4 then '已解决' when hhd.status=5 then '已关闭' when hhd.status=6 then '已取消' end)status ,
hhd.Assigned_Group ,hhd.assignee, hhd.Submit_Date,hhd.key,
(case when hhd.Phone_Number is not null and hhd.Description is not null and hhd.Reported_Source is not null and hhd.Detailed_Decription is not null
and hhd.impact is not null and hhd.Urgency is not null and Priority is not null and hhd.Service_Type is not null and hhd.Estimated_Resolution_Date is not null AND hhd.Assigned_Group is not null
and hhd.Assignee is not null and hhd.Product_Categorization_Tier_1 is not null
then 'Y' else 'N' end )ful,
(case when( hhd.service_type=1 and hwl.number_of_attachments =1 and hhd.Priority not in (0,1) ) or
(hhd.service_type=0 and hhd.Priority in (0,1) and hwl.number_of_attachments >1) then 'Y' when hhd.service_type=1 and hwl.number_of_attachments <1 then 'N' else '-' end )worklog,
(case when hhd.priority<=1 and csg.FUNCTIONAL_ROLE like '%Incident Manager%' then 'Y'
when hhd.priority<=1 and csg.FUNCTIONAL_ROLE not like '%Incident Manager%' then 'N' else '-' end )FUNCTIONAL_ROLE,
(case when hhd.status >=3 and hhd.Resolution is not null then 'Y' when hhd.status >=3 and hhd.Resolution is null then 'N' else '-' end)Resolution,
(case when ( hhd.Priority in (0,1) and hhd.status >=4 and hhd.service_type<>1 and hwl.number_of_attachments =1 ) or
(Priority in (0,1) and hhd.service_type=1 and hhd.status >=4 and hwl.number_of_attachments >1 ) then 'Y'
when ( hhd.Priority in (0,1) and hhd.service_type<>1 and hhd.status >=4 and ( hwl.number_of_attachments is null or hwl.number_of_attachments <1) )or
(hhd.Priority in (0,1) and hhd.service_type=1 and hhd.status >=4 and ( hwl.number_of_attachments is null or hwl.number_of_attachments <2 ) ) then 'N' else '-' end) critical,
(case when hhd.status >=5 and hhd.status_reason is not null then 'Y' when hhd.status >=5 and hhd.status_reason is null then 'N' else '-' end)status_reason
from (Select h.*,c.key From Hpd_Help_Desk h,HASCO_report_companyManpping c where h.company=c.value ) hhd
left join
(select distinct incident_number,z2af_work_log01,number_of_attachments from HPD_WORKLOG where z2af_work_log01 is not null and number_of_attachments is not null )hwl
on hhd.incident_number=hwl.incident_number
left join
( (select login_id ,ltrim( max(sys_connect_by_path(FUNCTIONAL_ROLE,'/')),'/')as FUNCTIONAL_ROLE from
( select login_id,FUNCTIONAL_ROLE ,
rank()over(order by login_id)+row_number()over(order by login_id )RN,row_number()over(partition by login_id order by login_id )RM from CTM_SUPPORTGROUPFUNCTIONALROLE ) start with RM=1 connect by prior RN=RN-1
group by login_id )) csg
on hhd.ASSIGNEE_LOGIN_ID=csg.login_id ) where ful<>'N' and worklog<>'N'
and functional_role<>'N' and resolution<>'N' and critical<>'N' and status_reason<>'N' )B
on a.incident_number=b.incident_number
group by To_Char((To_Date('19700101','yyyymmdd') + A.Submit_Date/86400 +To_Number(Substr(Tz_Offset(Sessiontimezone),1,3))/24),'YYYY-MM')
求大神 给解决 尝试着写一个存储过程 但里面有错误 代码太多 没发看 又不是自己写的
有遇到这类问题的没有啊 求指教啊 Java Oracle SQL select --------------------编程问答-------------------- java段不执行 ,有什么错误吗? --------------------编程问答-------------------- 你的标题和你的内容有什么关系吗? --------------------编程问答-------------------- 你的标题和你的内容有什么关系吗? --------------------编程问答--------------------
内容就是sql语句 --------------------编程问答--------------------
内容就是sql语句 --------------------编程问答--------------------
--------------------编程问答-------------------- debug,你在执行数据库的那句把sql截取出来,放在数据库里试试呢
?
--------------------编程问答-------------------- 要么字段要么特殊符号等等的错误。 --------------------编程问答-------------------- 还没有看明白你的话,你的意思是在oracle里面能执行的语句到了别的数据库执行不了么?还是什么。。。 --------------------编程问答-------------------- debug 把SQL语句打出来 看看能否执行 注意是否存在分号
补充:Java , Java相关