Why string + string doesn't work?


When you try to write an expresion like char + char or varchar + varchar, trying to append one string value to another, you'd get an error message like:

expression evaluation not supported

The reason is that + is not SQL standard operator for string concatenation. It is ||. Example:

select first_name||' '||last_name from employee;

Take a note, if one of the columns is NULL, the result will be NULL. Why? Well, NULL means that value is unknown, so if you put together a known and an unknown value, you don't know what will you get as a result. Thus the result is also unknown or NULL.

To work around that problem use COALESCE function.

Also, take a note that, unlike some other database systems, Firebird does follow SQL standard, and NULL is not the same as empty string ''


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous