Skip to Content
0
Former Member
Apr 23, 2009 at 04:41 PM

EXEC SQL , PROBLEM WITH SELECT

30 Views

Hi.

I have a external database in which I do the next query...

()

Data: cod_campana TYPE integer,

departament TYPE STRING.

EXEC SQL.

connect to 'EX_PP' as 'ex_pp'

ENDEXEC.

EXEC SQL.

set connection 'ex_pp'

ENDEXEC.

cod_campana = 272

departament = 'BKK' "-> This data it's variable

EXEC SQL.

OPEN c1 FOR

SELECT a.cod_modelo, a.nom_modelo2, a.cod_color, b.nom_color

FROM pro_modelos a ,con_color b

WHERE a.cod_modelo = b.cod_modelo

AND a.cod_campana = b.cod_campana

AND a.cod_color = b.numero

AND a.brand = :departament

AND a.cod_campana = :cod_campana

END EXEC

I obtain a dump and the reason it's in the phrase --> AND a.brand = :departament

When I execute the same query and don't put the variable --> AND a.brand = 'BKK' like this the program run correctly... and I don't obtain dump...

EXEC SQL.

OPEN c1 FOR

SELECT a.cod_modelo, a.nom_modelo2, a.cod_color, b.nom_color

FROM pro_modelos a ,con_color b

WHERE a.cod_modelo = b.cod_modelo

AND a.cod_campana = b.cod_campana

AND a.cod_color = b.numero

AND a.brand = 'BKK'

AND a.cod_campana = :cod_campana

END EXEC

I don't know what it's the problem, and how I can solve it...,

Can you help me??

I try the next phrases and not obtain a good result:

-


AND a.brand like :departament

-


departament = '"BSK"'

and a.brand = :departament

-


Thks for your help