Ver Mensaje Individual
  #1  
Antiguo 24-03-2014
Avatar de kaiserilich
kaiserilich kaiserilich is offline
Miembro
 
Registrado: mar 2010
Ubicación: planeta tierra
Posts: 42
Reputación: 0
kaiserilich Va por buen camino
Unhappy Error usando una sentecia IF dentro de un TUniQuery

hola,

tengo este query dentro de un component TUniQuery (UNIDAC)

Código:
if :TipoBusqueda = 'OP1'
begin
 Select data1..c1, data1..c2, data4..c9
 from data1, data2
 where 
   data4..c1 = data1..c1
  and data1..c1 like :ID
  and data1..c6 *= :CLI
 .
 .
 ....
end
else
begin
        if exists (select * from data1..c1 where data1..c1 like :ID and data1..c6 like :RSC )
        begin
   Select data1..c1, data1..c2, data2..c3 
   from data1, data2
   where 
     data2..c1 = data2..c1
    and data1..c1 like :ID
   .
   .
   ....
 
        end
        else
        begin
   Select data1..c1, data1..c2, data3..c5
   from data1, data3
   where 
     data3..c1 = data1..c1
    and data1..c1 like :ID
   .
   .
   ....   
  end
end
cuando intento ejecutarlo me da este error:

"The untyped variable ? is allowed only in in a WHERE clause or the SET clause of an UPDATE statement or VALUES list of an INSERT statement"

aquí la imagen: i58.tinypic.com/2u4ixvq.png

pero cuando lo ejecuto empleando BDE no tengo ningún error...

el problema esta en el 1er IF ( if :TipoBusqueda = 'OP1' ) pero la verdad no se me ocurre como resolverlo.

ahora bien la sentencia del IF debo dejarla dentro del componente no la puedo colocar fuera... : ( (así me lo exigen)

estoy usando:

Delphi 6 up 2
Unidac 5.2.7
ASE 12.5.4

si alguien me puede echar un cable...

gracias
Responder Con Cita