Re: Esql/c and OUTER JOIN
Posted in 2004
Topics: SQL Development & Query Writing, Connectivity: ESQL/C, 4GL & Embedded SQL
hobbes wrote:
> Well adding just a little thing
>
>
> It seems that if you declare cariable this way => ':variable' it works....
> For me it's just a workaround ...
> Don't think it's really ' a good way' of making the thing
It isn't a good way. It replaces your variables with string constants
that happen to look like a variable name - but they are string
constant, not a variable name. If you replaced them with 'FRA', then
you would have a query equivalent to your original.
> It seems working for me ...
> Can somebody (jonathan :) since you've have made my poor example work, i
> think it would be easier for you )
> test this plz ??
>
> Thank you !
>
> Arnaud
>
> ====
> exec sql declare democursor cursor for
> select l.num_lib,
> nvl(ll1.text,' '),
> nvl(ll2.text,' '),
> nvl(ll3.text,' ')
> from large l LEFT OUTER JOIN large_det ll1
> ON ll1.num_lib = l.num_lib and ll1.id_langue = ':large_det.id_langue'
> LEFT OUTER JOIN large_det ll2
> ON ll2.num_lib = l.num_lib and ll2.id_langue = '#'
> LEFT OUTER JOIN large_det ll3
> ON ll3.num_lib = l.num_lib and
> ll3.id_langue = ':large_det.id_langue'
> where l.categ = :categorie;> ====
>
>
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
"Jonathan Leffler" wrote: > > It seems that if you declare cariable this way => ':variable' it works.... > > For me it's just a workaround ... > > Don't think it's really ' a good way' of making the thing > > > It isn't a good way. It replaces your variables with string constants > that happen to look like a variable name - but they are string > constant, not a variable name. If you replaced them with 'FRA', then > you would have a query equivalent to your original. Yes.... I was too happy , yesterday when i thought i had found a solution. But it was only on specific case... When i work on normal case, data are wrong since, the variable is recognized as you describe it... So the only solution for now => hard coding the value in it :(
hobbes wrote: > "Jonathan Leffler" wrote: >>>It seems that if you declare cariable this way => ':variable' it >>>works.... >>It replaces your variables with string constants [...] > Yes.... > I was too happy , yesterday when i thought i had found a solution. > But it was only on specific case... > When i work on normal case, data are wrong since, the variable is recognized > as you describe it... > > So the only solution for now => hard coding the value in it :( Or prepare the statement with the values hard coded in it? -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
"Jonathan Leffler" wrote: > > > "Jonathan Leffler" wrote: > >>>It seems that if you declare cariable this way => ':variable' it > >>>works.... > >>It replaces your variables with string constants [...] > > Yes.... > > I was too happy , yesterday when i thought i had found a solution. > > But it was only on specific case... > > When i work on normal case, data are wrong since, the variable is recognized > > as you describe it... > > > > So the only solution for now => hard coding the value in it :( > > Or prepare the statement with the values hard coded in it? Yes that what i mean :) > -- > Jonathan Leffler #include <disclaimer.h> > Email: jleffler@earthlink.net, jleffler@us.ibm.com > Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/ >