Using the String Operator in Expressions

From InterBase

Go Up to Understanding SQL Expressions


The string operator, ||, also referred to as a concatenation operator, enables a single character string to be built from two or more character strings. Character strings can be constants or values retrieved from a column. For example,

char strbuf[80];
. . .
EXEC SQL
SELECT LAST_NAME || ' is the manager of publications.'
INTO :strbuf
FROM DEPARTMENT, EMPLOYEE
WHERE DEPT_NO = 5900 AND MNGR_NO = EMP_NO;

The string operator can also be used in INSERT or UPDATE statements:

EXEC SQL
INSERT INTO DEPARTMENT (MANAGER_NAME)
VALUES(:fname || :lname);

Advance To: