Friday, August 08, 2008

Concatenating String Fields in SQL (Oracle)

To concatenate 2 string fields in a select statement use the || operator (C#'s OR)

select firstName || ' ' || lastName as Name from tblNames;

Outputs:

Name

Barack Obama

George Bush

George Washington

Also, string constants are defined by single quotes (')

No comments:

Post a Comment

Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.