views:

2709

answers:

4

So I basically wanna display this (whole row in ONE column):

I like [type column] cake with [icing column] and a [fruit column].

The result should be:

Cake_Column

I like chocolate cake with whipped_cream and a cherry.

I like strawberry cake with vanilla_cream and a lemon_slice.

etc.

etc.

I need some sort of TO_CHAR statement that does ([column] "some text" [column]) "new_column_name";

What am I supposed to know?

+4  A: 

Did you try the || operator ?

Check this out>>>

Shankar Ramachandran
+3  A: 

select 'i like' || type_column || ' with' ect....

Dani
+1  A: 

You have two options for concatenating strings in Oracle:

CONCAT example:

CONCAT(
  CONCAT(
    CONCAT(
      CONCAT(
        CONCAT('I like ', t.type_desc_column), 
        ' cake with '), 
      t.icing_desc_column),
    ' and a '),
  t.fruit_desc_column)

Using || example:

'I like ' || t.type_desc_column || ' cake with ' || t.icing_desc_column || ' and a ' || t.fruit_desc_column
OMG Ponies
A: 

..I was missing one || and did not notice. I thought the error I was getting was because I was trying to rename the concatenated column or because you couldn't concatenate more than 2 columns.

Thanks :D

Thundordan