Computed Values in Firebird Queries

Most sql dialects allow calculated values and function calls in the select statements. In order to use the results in a program, an as clause is used to provide an identifier (the word "as" is optional).

String Concatenation | Function Call


String Concatenation

Somtimes, it is useful for a select query to return a single value containing data from several fields - when one string value is added to the end of another, the correct term is "concatenation".

The concatenation operator is language dependent - in Firebird SQL, it is 2 verticle bars.

A problem with this occurs when one of the fields returns a null value - in the case, the result of the concatenation is also null.

This can be "fixed" by using the coalesce function.

To actually use the result in a program, it is important to use the as clause (the word "as" is optional).

The following is an example from working Delhpi code - notice that the single quote is the Delphi string delimiter and, therefore, it is doubled to include it in the actual sql string.


Function Call

This is an example function call. In this case

See this for more information on Firebird generators


Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Databases / Delphi / Firebird / Computed_Values.html