Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Strange behavior in GROUP BY
Hi all,
the following query attempts to produce the total salary per the number of 'A's in employee name (scott/tiger) and it works.
select length(ename)-length(replace(ename,'A','')), sum(sal)
from emp
group by length(ename)-length(replace(ename,'A',''));
The next query tries to beautify output and it does not:
select 'number of A is ' || length(ename)-
length(replace(ename,'A','')), sum(sal)
from emp
group by 'number of A is ' || length(ename)-
length(replace(ename,'A',''));
I get an unexpected (for me) error, which I cannot figure out:
group by 'number of A is ' || length(ename)- length(replace(ename,'A',''))
*
(asterisk appears below the second bar of concat operator ||)
Something wrong with concatenation in GROUP BY? Something else?
TIA
Kostis Vezerides
Received on Thu Nov 29 2007 - 09:03:00 CST