O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Concatenating Strings with ||

Use the || (concatenation) operator to combine, or concatenate, strings. The || operator’s important characteristics are:

  • The || operator is two consecutive vertical-bar, or pipe, characters.

  • Concatenation doesn’t add a space between strings.

  • ||, a dyadic operator, combines two strings into a single string: 'formal' || 'dehyde' is 'formaldehyde'.

  • You can chain concatenations to combine multiple strings into a single string: 'a' || 'b' || 'c' || 'd' is 'abcd'.

  • Concatenation with an empty string ('') leaves a string unchanged: 'a' || '' || 'b' is 'ab'.

  • The result of any concatenation operation that involves a null is null: 'a' || NULL || 'b' is NULL. (But see the Oracle exception in the DBMS Tip in this section.)

  • To concatenate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required