[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: dynamic variables
On Mon, Sep 23, 2002 at 02:30:19PM -0400, Vallabhu, Bindu wrote:
> However i am using the dynamic variable [ ] braces around the variable
> because i tried using it without them and it did not work. Maybe because i
> am on a DB2 database.
Are you trying to look at the data in one particular column and see if
it contains first one particular value and then another value, or are
you try to compare two different columns in the different executions of
your Select?
In other words, are you trying to say:
where col1 = <some value>
or
where <some column> = 'X'
(where the value inside of <> is what changes between your executions)?
You would need to use dynamic SQL in the second case; there, you do need
to build a new SQL statement, since you are changing the actual database
object the statement references. In the first case, you shouldn't need
dynamic SQL.
I don't know anything about DB2's "peculiarities," but if you think your
application falls in the first case, feel free to post a code snippet
(as well as a description of what happened when it "did not work") and
we can try to see what might be happening (perhaps with help from
someone who does know DB2)...
Nathan
----------------------------------------------------------------------------
Nathan Stratton Treadway | Ray Ontko & Co. | Software consulting services
nathanst@ontko.com | Richmond, IN | http://www.ontko.com/