Using "+" or "||"

Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in 
ISQL to indicate a string concatenation.  I needed to paste my SQL 
statement into the PowerBuilder script painter for some embedded SQL, and 
PB didn't like the "||" very much at all.  I changed it to "+" and it 
seems to be ok.  Do these two operators indicate ~exactly~ the same 
thing?
0
Rick
2/20/2000 9:05:03 PM
πŸ“ sybase.powerbuilder.general
πŸ“ƒ 62418 articles.
⭐ 19 followers.

πŸ’¬ 6 Replies
πŸ‘οΈβ€πŸ—¨οΈ 2446 Views

moin,
afaik these two's are not the same!
if you're using "||" and any term is NULL then in the resultstring the term
will be ignored
if you use "+" then the resutlstring is NULL

mfg
==========================
andatec gesellschaft fοΏ½r
angewandte datentechnik mbh
Ruwoldtweg 15
22309 hamburg
---------------------------------------
Dipl.-Ing. GοΏ½nther Jungbluth
[email protected]
==========================

"Rick Charnes" <[email protected]> schrieb im Newsbeitrag
news:[email protected]
> Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in
> ISQL to indicate a string concatenation.  I needed to paste my SQL
> statement into the PowerBuilder script painter for some embedded SQL, and
> PB didn't like the "||" very much at all.  I changed it to "+" and it
> seems to be ok.  Do these two operators indicate ~exactly~ the same
> thing?


0
GJungbluth
2/21/2000 9:07:38 AM
You are comparing two different "languages" here: PowerScript and SQL.

SQL's string concatenation operator is || (at least for DBMS which
conform to the ANSI Standard, MS still uses +)

PowerScript's string concatenation operator is + 

Regards
Thomas


Rick Charnes wrote:
> 
> Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in
> ISQL to indicate a string concatenation.  I needed to paste my SQL
> statement into the PowerBuilder script painter for some embedded SQL, and
> PB didn't like the "||" very much at all.  I changed it to "+" and it
> seems to be ok.  Do these two operators indicate ~exactly~ the same
> thing?
0
Thomas
2/21/2000 3:24:58 PM
Right.  So how can I use SQL's || operator when my SQL is embedded inside 
my Powerscript?  Powerscript doesn't seem to like || very much...  
Thanks.

In article <[email protected]>, [email protected] 
says...
> You are comparing two different "languages" here: PowerScript and SQL.
> 
> SQL's string concatenation operator is || (at least for DBMS which
> conform to the ANSI Standard, MS still uses +)
> 
> PowerScript's string concatenation operator is + 
> 
> Regards
> Thomas
> 
> 
> Rick Charnes wrote:
> > 
> > Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in
> > ISQL to indicate a string concatenation.  I needed to paste my SQL
> > statement into the PowerBuilder script painter for some embedded SQL, and
> > PB didn't like the "||" very much at all.  I changed it to "+" and it
> > seems to be ok.  Do these two operators indicate ~exactly~ the same
> > thing?
> 
0
Rick
2/21/2000 3:26:37 PM
As soon as you have embedded SQL you should be able to use the || if the 
DBMS of the current database connection uses that operator.

The following code works for me (being connected to an Oracle DB):

string ls_FullName

SELECT name||', '||first_name
INTO :ls_FullName
FROM person
WHERE personid = 'XYZ'
USING SQLCA;

if sqlca.sqlcode = 0 then
   MessageBox("Fullname", ls_FullName)
else
   MessageBox("Error", sqlca.sqlerrtext)
end if

Regards
Thomas


Rick Charnes wrote:
> 
> Right.  So how can I use SQL's || operator when my SQL is embedded inside
> my Powerscript?  Powerscript doesn't seem to like || very much...
> Thanks.
> 
> In article <[email protected]>, [email protected]
> says...
> > You are comparing two different "languages" here: PowerScript and SQL.
> >
> > SQL's string concatenation operator is || (at least for DBMS which
> > conform to the ANSI Standard, MS still uses +)
> >
> > PowerScript's string concatenation operator is +
> >
> > Regards
> > Thomas
> >
> >
> > Rick Charnes wrote:
> > >
> > > Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in
> > > ISQL to indicate a string concatenation.  I needed to paste my SQL
> > > statement into the PowerBuilder script painter for some embedded SQL, and
> > > PB didn't like the "||" very much at all.  I changed it to "+" and it
> > > seems to be ok.  Do these two operators indicate ~exactly~ the same
> > > thing?
> >

-- 
=======================================================
It's not the fall that kills you - it's the sudden stop
0
Thomas
2/21/2000 3:33:38 PM
Yes, your code works for me as well, using SQLAnywhere 5.5.04.  I was 
thrown off by the fact that the Powerscript painter shades all occurences 
of the || operator inside embedded SQL in a maroon color, which I usually 
associate to mean something is wrong.  Any idea what it's try to tell me?

In article <[email protected]>, [email protected] 
says...
> As soon as you have embedded SQL you should be able to use the || if the 
> DBMS of the current database connection uses that operator.
> 
> The following code works for me (being connected to an Oracle DB):
> 
> string ls_FullName
> 
> SELECT name||', '||first_name
> INTO :ls_FullName
> FROM person
> WHERE personid = 'XYZ'
> USING SQLCA;
> 
> if sqlca.sqlcode = 0 then
>    MessageBox("Fullname", ls_FullName)
> else
>    MessageBox("Error", sqlca.sqlerrtext)
> end if
> 
> Regards
> Thomas
> 
> 
> Rick Charnes wrote:
> > 
> > Right.  So how can I use SQL's || operator when my SQL is embedded inside
> > my Powerscript?  Powerscript doesn't seem to like || very much...
> > Thanks.
> > 
> > In article <[email protected]>, [email protected]
> > says...
> > > You are comparing two different "languages" here: PowerScript and SQL.
> > >
> > > SQL's string concatenation operator is || (at least for DBMS which
> > > conform to the ANSI Standard, MS still uses +)
> > >
> > > PowerScript's string concatenation operator is +
> > >
> > > Regards
> > > Thomas
> > >
> > >
> > > Rick Charnes wrote:
> > > >
> > > > Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in
> > > > ISQL to indicate a string concatenation.  I needed to paste my SQL
> > > > statement into the PowerBuilder script painter for some embedded SQL, and
> > > > PB didn't like the "||" very much at all.  I changed it to "+" and it
> > > > seems to be ok.  Do these two operators indicate ~exactly~ the same
> > > > thing?
0
Rick
2/21/2000 4:29:27 PM
The maroon shading is just a syntax highlighting quirk -- your code should
compile OK with '||'.

--
pbm_hopethishelps,
Roy Kiesler [TeamSybase]
Sybase Developers Network (SDN) - http:///www.sybase.com/sdn

"Rick Charnes" <[email protected]> wrote in message
news:[email protected]
> Yes, your code works for me as well, using SQLAnywhere 5.5.04.  I was
> thrown off by the fact that the Powerscript painter shades all occurences
> of the || operator inside embedded SQL in a maroon color, which I usually
> associate to mean something is wrong.  Any idea what it's try to tell me?
>
> In article <[email protected]>, [email protected]
> says...
> > As soon as you have embedded SQL you should be able to use the || if the
> > DBMS of the current database connection uses that operator.
> >
> > The following code works for me (being connected to an Oracle DB):
> >
> > string ls_FullName
> >
> > SELECT name||', '||first_name
> > INTO :ls_FullName
> > FROM person
> > WHERE personid = 'XYZ'
> > USING SQLCA;
> >
> > if sqlca.sqlcode = 0 then
> >    MessageBox("Fullname", ls_FullName)
> > else
> >    MessageBox("Error", sqlca.sqlerrtext)
> > end if
> >
> > Regards
> > Thomas
> >
> >
> > Rick Charnes wrote:
> > >
> > > Right.  So how can I use SQL's || operator when my SQL is embedded
inside
> > > my Powerscript?  Powerscript doesn't seem to like || very much...
> > > Thanks.
> > >
> > > In article <[email protected]>,
[email protected]
> > > says...
> > > > You are comparing two different "languages" here: PowerScript and
SQL.
> > > >
> > > > SQL's string concatenation operator is || (at least for DBMS which
> > > > conform to the ANSI Standard, MS still uses +)
> > > >
> > > > PowerScript's string concatenation operator is +
> > > >
> > > > Regards
> > > > Thomas
> > > >
> > > >
> > > > Rick Charnes wrote:
> > > > >
> > > > > Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||"
in
> > > > > ISQL to indicate a string concatenation.  I needed to paste my SQL
> > > > > statement into the PowerBuilder script painter for some embedded
SQL, and
> > > > > PB didn't like the "||" very much at all.  I changed it to "+" and
it
> > > > > seems to be ok.  Do these two operators indicate ~exactly~ the
same
> > > > > thing?


0
Roy
2/21/2000 7:17:11 PM
Reply: