oracle 11g复杂子查询包含order by语句报错问题

梁某某 发布于 2013/08/06 13:40
阅读 771
收藏 0

我的测试SQL为:

SELECT * FROM ( SELECT 
 ems_exam_arrange.PKID,
 ems_exam_arrange.exam_type,
 ems_exam_arrange.start_time,
 ems_exam_arrange.end_time,
 ems_exam_arrange.pk_paper,
 ems_exam_arrange.create_on,
 ems_exam_arrange.modify_on,
 ems_exam_arrange.create_by,
 ems_exam_arrange.modify_by,
 ems_exam_arrange.arrange_status,
 ems_exam_arrange.title,
 (CASE WHEN ems_exam_arrange.arrange_paper_type='3'  THEN t.templet_name ELSE p.paper_name END) paper_name,
 ems_exam_arrange.exam_length,
 ems_exam_arrange.islock,
 ems_exam_arrange.pk_subject,
 p.pk_sub,
 s.sub_name,
 ems_exam_arrange.arrange_paper_type,
 ems_exam_arrange.backview,
 ems_exam_arrange.marking_time,
 ems_exam_arrange.publishsocre_time
 FROM 
 ems_exam_arrange,
ems_exam_paper_base p,
ems_exam_subject s,
ems_paper_templet t
WHERE 
 (ems_exam_arrange.pk_paper = p.PKID(+)) AND 
(ems_exam_arrange.pk_subject = s.PKID(+)) AND 
(ems_exam_arrange.pk_paper = t.PKID(+))
  AND (
  (ems_exam_arrange.marking_time<='2013-08-06 13:35:35' or ems_exam_arrange.marking_time IS NULL) and 
	
	ems_exam_arrange.pk_subject IN(SELECT PKID FROM ems_exam_subject WHERE sub_code LIKE 
	(SELECT sub_code||'%' FROM ems_exam_subject WHERE PKID='
	
	11308051007125860040' ) AND sub_type='2' )
 )
 ORDER BY 
 ems_exam_arrange.pkid DESC
  ) WHERE rownum <= 10

去掉 子查询中的

ORDER BY 
 ems_exam_arrange.pkid DESC
就没有错了

错误为:

java.sql.SQLException: 无法从套接字读取更多的数据
加载中
返回顶部
顶部