Subject RE: [IBO] TIB_Query and SQL Statements, Off-topic
Author Alan McDonald
this won't work in a TIB_Query. You need to do the same in delphi code where
you clear and re-assign the IB_Query.SQLWhere string list.
and the like clause neeeds to be '%string%' i.e. don't concatenate them,
create them.
I thi8nk you'll also need to use the beginupdate, endupdate calls around
your re-assignment so the query doesn't act on the change til your finished.
Alan

-----Original Message-----
From: David Husarik [mailto:davidhusarik@...]
Sent: Saturday, 8 March 2003 10:13 AM
To: ibobjects
Subject: [IBO] TIB_Query and SQL Statements, Off-topic


Hi Group;

Is it possible to setup the SQL statement in a
TIB_Query component as follows.

DECLARE VARIABLE aNumber INTEGER
aNumber = :theNumber

if (aNumber = 1) then
select * from table_A where ID = :ID
else
if (aNumber = 2) then
select * from table_A where NAME LIKE
'%'||:NAME||'%'
else
if (aNumber = 3) then
select * from table_A where CITY LIKE
'%'||:CITY||'%'

Is this statement valid?
Another question, is this the correct syntax for a
like statement. I have used this syntax in stored
procedures and it seems to work about 50% of the time.
Sometimes I get the results I expect other times I do
not.

TIA
David Husarik


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/