Thread: Query with case
View Single Post
  #1 (permalink)  
Old November 9th, 2004, 10:39 AM
marcomfigueroa marcomfigueroa is offline
Registered User
 
Join Date: Nov 2004
Location: Bogtoa, Cundinamarca, Colombia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to marcomfigueroa Send a message via Yahoo to marcomfigueroa
Default Query with case

hello, i have this query, it works in Oracle 9 and 8 but not works in oracle 7, appears an Oracle: ORA-00907: missing right parenthesis error in the line where the CASE begins....

some help???

select o.identificacion,
count (*) envios,
count (c.rtado_presentacion) colocaciones,

(case
      when (count (c.rtado_presentacion))>= 1
      then min (c.cno_oferta)
end) cnoCol1,

(case
      when (count (c.rtado_presentacion))>= 1
      then substr (min (c.cno_oferta),1,1)
end) area1col1,

(case
      when (count (c.rtado_presentacion))>= 1
      then substr (min (c.cno_oferta),2,1)
end) nivel1col1,

(case
      when (count (c.rtado_presentacion))>= 2
      then max (c.cno_oferta)
end) cnocol2,

(case
      when (count (c.rtado_presentacion))>= 2
      then substr (max (c.cno_oferta),1,1)
end) areacol2,

(case
      when (count (c.rtado_presentacion))>= 2
      then substr (max (c.cno_oferta),2,1)
end) nivelcol2

from cruce c, ofertas o
where o.fecha_inscripcion >= '01/01/2004'
and o.fecha_inscripcion <= '09/30/2004'
and c.identificacion_oferta = +o.identificacion
group by o.identificacion
order by colocaciones