Re: PROC: Dynamic SQL

From: Vandra Huber <vandra_at_u.washington.edu>
Date: 1996/07/22
Message-ID: <31F47725.1532_at_u.washington.edu>#1/1


Reinhard Schmidt wrote:
>
> > Hi All,
> > I have a Probelm with dynamic sql in PRO*C.
> > the sql statement is like " select * from mytable where name = :f1".
> > it works fine if the bind variable has all the N chars , where N
> > is the length of the coulmn name. but it returns nothing if the bind
> > variable has a value whose length is less than the column
> > length. Any ideas?
> >
> > thanks a lot, ash.
> >
> Is your bind variable char or varchar. I recommend to use varchar and to set
> varchar.len accordingly.
>
> ----
>
> Reinhard Schmidt Reinhard_at_schmidt.do.eunet.de

I believe that this is a classic change in the ANSI code scheme.

In non-ANSI (version 6) if the variable is too small, the system tried to populate the variable with no warnings.

Under ANSI, this would create a warning. To deal with the warning, one needs to add an indicator variable ( a short) to the bind variable

EG

        EXEC SQL select ... into :myVariable :myIndicatorVariable ...;

The variable is 0 (zero) if successful, -1 if null or +1 if ??? In any case, if the indicator is not there, nothing is done..

Mike Krolewski mkrolews_at_upw.com Received on Mon Jul 22 1996 - 00:00:00 CEST

Original text of this message