× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Bob C. said:
>
> SQL can only refer to GLOBAL variables. So if it is used in a
> procedure is may not work or compile.
>
> -Bob
>

Bob, i keep hearing that everywhere, but i have never ran into problems by
using local variables, even parameters, as host variables on my embedded SQL
sentences.

Here's an example that compiles fine:

<snippet>

p SQLDomCod       B                   EXPORT
d SQLDomCod       PI             1a
d   pTipos                       5a   varying
d   pPref                        3p 0
d   pCliNum                      9p 0
d   pResult                           like(SQLDomCod)
d   pInd1                        5i 0
d   pInd2                        5i 0
d   pInd3                        5i 0
d   pResultInd                   5i 0
d   pSQLSTATE                    5a
d   pFuncName                  139A   VARYING
d   pSpecName                  128A   VARYING
d   pMsgTxt                     70A   VARYING

....

c/exec sql
c+ SELECT A3CODD INTO :pResult
c+   FROM A3DOM3
c+  WHERE A3PCLI = :pPref AND A3NCLI = :pCliNum
c+    AND A3CORR = '1'
c/end-exec

...

p SQLDomCod       E

</snippet>

Carlos K.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.