[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Problem with SQR string concatenation ? Please help!



Ferd,

When I have dynamic values in a where, I put the entire where clause
in a variable...

        let $where = 'WHERE agy_wc in ' || $agycodes   (and more ... || ...
if needed)

        :
        :
        :

        then in the select statement:

        begin-select

        agy_wc    &agywc
           :                :
           :                :


        from t_agents ...
        [$where]

        end-select




[] - SQR substitutes the variable in the square brackets into the select
statement


Tom Bambach

> -----Original Message-----
> From: Ferdinand de Lesseps [SMTP:ezfred0131@yahoo.com]
> Sent: Wednesday, January 29, 2003 11:53 PM
> To:   sqr-users@sqrug.org
> Subject:      Re: [sqr-users] Problem with SQR string concatenation ?
> Please help!
> 
> Hi,The problem is that the concatenated string appears
> fine (I've checked it thru debug commands) outside the
> select (begin-select....end-select) statement.
> However, inside the select statement, it fails to be
> recognized. Any reasons ? Please help!
> 
> Thanks!
> Ferd.
> 
> --- Ferdinand de Lesseps <ezfred0131@yahoo.com> wrote:
> > Hi,,
> >  I had "in" in my original code, I put "=" by
> > mistake
> > in this example..
> > 
> > Thanks for your response.
> > 
> > -Ferd
> > --- Larry Roux <lroux@syr.edu> wrote:
> > > You don't want = you want "in"
> > > 
> > > where
> > > agy_wc in $agycodes and .... 
> > > 
> > > 
> > > ******************************
> > > Larry Roux
> > > Syracuse University
> > > lroux@syr.edu
> > > *******************************
> > > >>> ezfred0131@yahoo.com 01/29/03 19:42 PM >>>
> > > I formed a string concatenating few of the command
> > > line arguments. I checked for the wellformedness
> > of
> > > the resultant string, it was exactly what I
> > wanted..
> > > 
> > > I went into a procedure, there I concatenated the
> > > string with parenthesis; it looked good. But, when
> > I
> > > try using this string inside sql select statement
> > > (begin-select...end-select), it won't be
> > > recognized..don't know why..
> > > 
> > > Code fragments:
> > > >>>string<<<
> > > $agycodes = 'A6'||','||'A7'||','||'M4' =>
> > > 'A6','A7','M4'
> > > >>>inside procedure<<<
> > > let $agycodes = '('||$agycodes||')'
> > > #debug show $agycodes.....would give me
> > > ('A6','A7','M4') which is what I want.
> > > 
> > > >>>inside select statement<<<
> > > begin-select
> > > agy_wc &agywc
> > > agt_wc &agtwc
> > > agt_seq &agtseq
> > > .....
> > > .....
> > > from t_agents .....
> > > where
> > > agy_wc = $agycodes and .....
> > > .....
> > > end-select
> > > 
> > > Works when I hard-code ('A6','A7','M4') in place
> > of
> > > $agycodes, but won't work otherwise. It won't give
> > > me
> > > any error or exception, however the sqr will
> > > terminate
> > > immediately, which makes it even more difficult to
> > > debug..Any idea what's happening ? Is it something
> > > to
> > > do with parens, commas ? Would really appreciate
> > any
> > > help..
> > > 
> > > Thanks in advance..
> > > 
> > > __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > > now.
> > > http://mailplus.yahoo.com
> > > 
> > > _______________________________________________
> > > sqr-users mailing list
> > > sqr-users@sqrug.org
> > > http://www.sqrug.org/mailman/listinfo/sqr-users
> > > 
> > > 
> > > _______________________________________________
> > > sqr-users mailing list
> > > sqr-users@sqrug.org
> > > http://www.sqrug.org/mailman/listinfo/sqr-users
> > 
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > http://mailplus.yahoo.com
> > 
> > _______________________________________________
> > sqr-users mailing list
> > sqr-users@sqrug.org
> > http://www.sqrug.org/mailman/listinfo/sqr-users
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> 
> 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users