Group by caluse before where clause
209029Oct 30 2003 — edited Oct 30 2003Hi all,
Declare
cursor c1 is select ARc_Month as mnth,count(*) as nof from dbarc
group by ARc_Month
where ARc_Month like '%02%';
e1 varchar2(1000);
cnt number(10);
begin
e1:='1';
for crec in c1 loop
cnt:= c1%rowcount;
dbms_output.put_line(cnt||'------'||crec.mnth||'-------'||crec.nof);
end loop;
end ;
/
Please go through the select statement for the cursor C1 which is syntactically worng but, the cursor is giving correct data. If the same select statement is run independently i.e at the sql prompt then it giving the following error, I knew that the error is due to the group by clause is before where clause. but it is not giving error while executing using explicit cursor.
SQL> select arc_month as mnth,count(*) as nof from dbarc
2 group by arc_month
3 where arc_month like '%02%';
where arc_month like '%02%'
*
ERROR at line 3:
ORA-00933: SQL command not properly ended
can anybody resolve this ambiguity. my oracle version is 8.1.7, Is this a known bug or unknown
Thanks in advance.