Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2011
    Posts
    4

    Unanswered: Concatenation of columns of different datatypes

    Hi I want to Concatenate columns of different datatype.

    create table temp ( colA date , colB clob , colC clob , colD varchar2(50), colE varchar2(50), ColF blob);

    insert into temp (ColA,ColB,ColC,ColD,COlE)
    values ('10-JAN-1999','AAAAAA','BBBBBB','CC','DD');


    insert into temp (ColA,ColB,ColC,ColD,COlE)
    values ('','AAAAAA','BBBBBB','CC','DD');


    insert into temp (ColA,ColB,ColC,ColD,COlE)
    values ('','','','CC','DD');


    insert into temp (ColA,ColB,ColC,ColD,COlE)
    values ('10-JAN-1999','','','','DD');


    insert into temp (ColA,ColB,ColC,ColD,COlE)
    values ('','AAAAAA','','CC','');

    In colF which is of BLOB I want output where ColA , ColB , ColC , ColD, ColD and ColE gets concatenated , according to the values in the columns.

    Eg row 1 of COLF will be

    ColA:
    10/01/1999
    ColB :
    AAAAA
    ColC:
    BBBBBB
    ColD:
    CC
    ColE:
    DD


    Row 2 , ColF

    ColB :
    AAAAA
    ColC:
    BBBBBB
    ColD:
    CC
    ColE:
    DD

    Row 3 , ColF


    ColD:
    CC
    ColE:
    DD

    etc..

  2. #2
    Join Date
    Dec 2007
    Posts
    253
    To get a carriage return, you can use chr(10)
    To concatenate, you use ||
    To convert any non character datatype to a character datatype, use to_char() function.

    HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •