Re: 4GL Concatenation Problem
Posted in 1998
I don't see why you can't prepare and execute the statement in 4gl. What
does the number 255 have to do with the length of character variables in
4gl?
define ptxt char(1000)
let ptxt = "insert into datsum (vend_id,...)"
," select distinct vend_id,..."
," and campshift.weekdays like '%'||weekday(jdate)||'%'"
prepare pinsert from ptxt
...
Note that the concatenation symbol in 4gl is "," and not "||" but by
preparing the statement in 4gl you are asking the database engine to do
the concatenation.
----------------------------------------------------------------------
John H. Frantz Power-4gl: Extending Informix-4gl
john@rl.is http://www.rl.is/~john/pow4gl.html
jhannah@mammoth.org wrote:
>
> Greetings --
>
> I have a long SQL statement that I am trying to pass to Informix from 4GL, and
> am having some syntax problems. '||' works fine in dbaccess and E/SQL, but 4GL
> chokes:
>
> insert into datsum (vend_id, <snip!>)
> select distinct vend_id, <snip!>
> and campshift.weekdays like '%' || weekday(jdate) || '%'> |__________________________________^
> |
> | There is an invalid character in the above line.
> | See error number -4409.
>
> I cannot load the %weekday(jdate)% string into a 4GL variable, because
> the result of weekday(jdate) changes from line to line.
>
> I cannot let, prepare, and then execute the command because it is longer than
> 255 characters (a varchar(255) will not hold it). In theory, I guess I could
> load it into strSQL1, strSQL2, etc. but I was hoping for a prettier solution.
>
> Any ideas?
>
> Thanks,
>
> Jay Hannah
>
> DB-Access Version 7.20.UC5
> INFORMIX-4GL Version 6.05.UD1
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading