Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   Error usando una sentecia IF dentro de un TUniQuery (https://www.clubdelphi.com/foros/showthread.php?t=85489)

kaiserilich 24-03-2014 13:31:36

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


La franja horaria es GMT +2. Ahora son las 23:27:36.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi