Query not working with SQL reports

Any idea why the following query is not running in SQL reports (I installed the latest version available)? The same query produce the needed results in SQL Developer. The idea of the query is to get a summary of the number of Discipline Reports obtained by students in a range of dates. That information need to include parents data like their e-mails. I am using de regexp_substr in order to split the guardianemail field by the semicolon operator ; because we are storing at that field the emails of both parents associated to students.

SELECT students.student_number,students.lastfirst,students.grade_level,
sum(decode(gen.name,'Discipline',1,0)),students.father,students.mother,
regexp_substr(DBMS_LOB.SUBSTR(students.guardianemail,SYS.dbms_lob.getlength(students.guardianemail),1),'[^;]+',1,1),
regexp_substr(DBMS_LOB.SUBSTR(students.guardianemail,SYS.dbms_lob.getlength(students.guardianemail),1),'[^;]+',1,2)

FROM
LOG
inner join students on log.studentid=STUDENTS.id
inner join gen on log.logtypeid=gen.id
WHERE STUDENTS.ENROLL_STATUS=0
and gen.name ='Discipline'
and log.schoolid='1234'

and LOG.ENTRY_DATE > =to_date('04-01-2013','mm-dd-yyyy')
and LOG.ENTRY_DATE < =to_date('05-01-2013','mm-dd-yyyy')
group by students.student_number,students.lastfirst,students.father,students.mother,students.grade_level,
DBMS_LOB.SUBSTR(students.guardianemail,SYS.dbms_lob.getlength(students.guardianemail),1)
order by students.grade_level,students.lastfirst

Subscribe to Comments for "Query not working with SQL reports"