[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!



Alright boys and girls,

When you reference an SQR variable in a WHERE clause (as in Where
Test_Column = $Variable) it is bound as a single value.  To do what this
thread requires is to use the SQR ability to dynamically create a SQL
statement.  To do this you use the construct [$Variable] which would look
like Where Test_Column In ([$In_Clause]).  SQR will replace [$In_Clause]
with the actual contents of $In_Clause when the Begin-Select is executed.

You can use the [$SQR_Variable] contruct in both BEGIN-SQL and BEGIN-SELECT
statements.

Peter

-----Original Message-----
From: Prasanna Menta [ mailto:pmenta@umuc.edu <mailto:pmenta@umuc.edu> ]
Sent: Thursday, January 30, 2003 7:52 AM
To: sqr-users@sqrug.org
Subject: Re: [sqr-users] Problem with SQR string concatenation ? Please
help!


Can you try trimming the spaces, say use rtrim(ltrim(<variable>,' '),'
') which might help you.
Good Luck
Prasanna

Ferdinand de Lesseps wrote:
>
> 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 <http://mailplus.yahoo.com> 
> > >
> > > _______________________________________________
> > > sqr-users mailing list
> > > sqr-users@sqrug.org
> > > http://www.sqrug.org/mailman/listinfo/sqr-users
<http://www.sqrug.org/mailman/listinfo/sqr-users> 
> > >
> > >
> > > _______________________________________________
> > > sqr-users mailing list
> > > sqr-users@sqrug.org
> > > http://www.sqrug.org/mailman/listinfo/sqr-users
<http://www.sqrug.org/mailman/listinfo/sqr-users> 
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > http://mailplus.yahoo.com <http://mailplus.yahoo.com> 
> >
> > _______________________________________________
> > sqr-users mailing list
> > sqr-users@sqrug.org
> > http://www.sqrug.org/mailman/listinfo/sqr-users
<http://www.sqrug.org/mailman/listinfo/sqr-users> 
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com <http://mailplus.yahoo.com> 
>
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
<http://www.sqrug.org/mailman/listinfo/sqr-users> 

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

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