DB2 V8 String Parsing Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skumar08
    New Member
    • Oct 2008
    • 2

    #1

    DB2 V8 String Parsing Question

    Dear DB2 Experts,
    I have many rows in a table which is of the format as shown below. The last column starting from "#Wed Oct 08 13:51:35 EDT 2008 to the closing " after the ROUNUM are multi-lines.

    2250307,"120005 ",1,24931332000 00,1,0,"#Wed Oct 08 13:51:35 EDT 2008
    C_NUMBER=5001
    RNUMBER=1234567 890
    CH_AMOUNT=50.00
    RO_NUM=01140153 3
    AC_NUMBER=22334 4557788
    AlType=ItemClea red
    ACCNUMBER=22334 4557788-1
    ACC_TYPE=Checki ng
    ONETIME=true
    ROUNUM=01234566 0
    "
    I would like to know if there is way to combine all the multilines into a single line separated by a separator like
    2250307,"120005 ",1,24931332000 00,1,0,"#Wed Oct 08 13:51:35 EDT 2008,
    C_NUMBER=5001,R NUMBER=12345678 90,CH_AMOUNT=50 .00,RO_NUM=0114 01533,AC_NUMBER =223344557788,A lType=ItemClear ed,ACCNUMBER=22 3344557788-1,ACC_TYPE=Chec king,ONETIME=tr ue,ROUNUM=01234 5660"


    Thank you in advance for your reply.
    Kumar
  • docdiesel
    Recognized Expert Contributor
    • Aug 2007
    • 297

    #2
    Hi,

    you may use the REPLACE() function of DB2 (see also IBM DB2 Infocenter). I guess you'll have to escape the LF character as CHAR(10), or if it's text from a Windows system CHAR(10*256+13) .

    Regards

    Doc Diesel

    Comment

    Working...