Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

Concatenated Character Expressions

Description

The || concatenation operator (two vertical bars) || or + (plus) concatenates the two character expressions it separates.

The concatenation operator is similar to the CONCAT scalar function. However, the concatenation operator allows easy concatenation of more than two character expressions, while the CONCAT scalar function requires nesting.

Syntax

concatenated-char-expr ::

{character-literal | character-expr } { || | + } { character-literal | character-expr}

[ {character-literal | character-expr } { || | + } { character-literal

| character-expr} ] [ ... ]

Arguments

character-literal

A character literal. Refer to Character String Literals for details on specifying character literals.

character-expr

Any expression that evaluates to a character string (refer to Data Types for details of character data types), including column names and scalar functions that return a character string.

Examples

ISQL> SELECT 'Today''s date is ' || TO_CHAR(SYSDATE) FROM SYSCALCTABLE;

TODAY'S DATE IS 08/17/1998

--------------------------

Today's date is 08/17/1998

1 record selected


ISQL> SELECT 'Today''s date is ' + TO_CHAR(SYSDATE) FROM SYSCALCTABLE;

TODAY'S DATE IS 08/17/1998

--------------------------

Today's date is 08/17/1998

1 record selected

TOCIndex