Merging Column Output Using Concatenation


You can merge the display of columns using concatenation. This allows you to create more friendly and meaningful output. For example, in the customers table, the first_name and last_nam e columns contain the customer name . In the previous examples, these columns were selected and displayed independently. Wouldn t it be nice to merge the display of those columns together under one column heading? You can do this using the concatenation operator ( ), as shown in the following example:

  SELECT first_name  ' '  last_name AS "Customer Name"   FROM customers;  Customer Name -------------------- John Brown Cynthia Green Steve White Gail Black Doreen Blue 

Notice that a space character is concatenated to the first_name column, and then the last_name column is concatenated to the resulting string.




Oracle Database 10g SQL
Oracle Database 10g SQL (Osborne ORACLE Press Series)
ISBN: 0072229810
EAN: 2147483647
Year: 2004
Pages: 217

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net