Resend from correct account.

Ward Analytics Ltd - information in motion
Tel: +44 (0) 118 9740191
Fax: +44 (0) 118 9740192
www: http://www.ward-analytics.com

Registered office address: The Oriel, Sydenham Road, Guildford, Surrey,
United Kingdom, GU1 3SR
Registered company number: 3917021 Registered in England and Wales.


-----Original Message-----
From: David Wellman [mailto:david.well...@ward-analytics.com] 
Sent: 31 May 2013 18:05
To: 'General Discussion of SQLite Database'
Subject: RE: [sqlite] Concatenating literals with column values

Hi Michael,

Ok, you caught me out. I actually only tried it in one (Teradata) which is
the dbms that I've worked with most over the last few years. That is
certainly not completely 'standard' in terms of what syntax it supports-
which is probably true of most dbms's - but I didn't think this area would
be different.

Anyhow, I now have sql that gives me the answer that I'm expecting.

Cheers,
Dave


Ward Analytics Ltd - information in motion
Tel: +44 (0) 118 9740191
Fax: +44 (0) 118 9740192
www: http://www.ward-analytics.com

Registered office address: The Oriel, Sydenham Road, Guildford, Surrey,
United Kingdom, GU1 3SR Registered company number: 3917021 Registered in
England and Wales.


-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Michael Black
Sent: 31 May 2013 17:37
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] Concatenating literals with column values

Your statement doesn't even work in MySQLas || is a logical operator there.
And Oracle complains about your original query:
SQL> select stepid  ,'STEPID'||stepid  ,stepid+5
,'STEPID'||stepid+5,'STEPID'||5 from seqtable; select stepid
,'STEPID'||stepid  ,stepid+5  ,'STEPID'||stepid+5,'STEPID'||5 from seqtable
                                                       * ERROR at line 1:
ORA-01722: invalid number

And Oracle works with parentheses just like SQLite does:
SQL> select stepid  ,'STEPID'||stepid  ,stepid+5
,'STEPID'||(stepid+5),'STEPID'||5 from seqtable; 

    STEPID 'STEPID'||STEPID                                 STEPID+5
---------- ---------------------------------------------- ----------
'STEPID'||(STEPID+5)                           'STEPID
---------------------------------------------- -------
         5 STEPID5                                                10
STEPID10                                       STEPID5


So I'm not sure what "other" databases you're talking about.

What you're seeing is operator precedence.  || has the highest precedence so
you need the parentheses to override that.


-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dave Wellman
Sent: Friday, May 31, 2013 11:08 AM
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] Concatenating literals with column values

Hi Richard,
Many thanks, that works.

Why do I need the "()" around my calculation? (apart from 'because that
makes it work' !) I've used other dbms's and don't need them there.

Cheers,
Dave



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to