×
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.
Dynamic SQL is a possible solution...but if you use it, make sure
you're doing it with parameters
wSqlStmt = 'select myfield from mytable where fld1 = ?';
exec SQL
prepare S1 from wSqlStmt;
exec SQL
open C1 using :selectedValue;
and not this:
wSqlStmt = 'select myfield from mytable where fld1 = ' + selectedValue;
exec SQL
prepare S1 from wSqlStmt;
exec SQL
open C1;
which is open to SQL injection.
Dynamic SQL is not usually required however; static SQL can handle
most variable WHERE and ORDER BYs and usually performs better...
exec SQL
select myfield from mytbale
where :selectedValue in (' ', fld1);
order by
case when :selectedValue = ' ' then myfield else fld1;
On Fri, Jul 29, 2011 at 11:33 AM, Monnier, Gary <Gary.Monnier@xxxxxxxxx> wrote:
As others have said it sounds like Dynamic SQL is the way you want to
go.
As an Amazon Associate we earn from qualifying purchases.