Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2006
    Location
    Columbus, OH
    Posts
    69

    Unanswered: Split substrings into multiple records

    Not sure where to start with this. I'm thinking it will need to be some kind of PL/SQL block.

    Need to split a record that looks like this

    012313 ServerA|ServerB|ServerC Open

    into 3 records

    012313 ServerA Open
    012313 ServerB Open
    012313 ServerC Open

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >I'm thinking it will need to be some kind of PL/SQL block.
    YES

    Please proceed to do so

    It is bad "design" to store multiple values in a single field/column & now you pay the price.

    ALWAYS
    Post Operating System (OS) name & version for DB server system.
    Post results of
    SELECT * from v$version
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Sep 2006
    Location
    Columbus, OH
    Posts
    69
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    "CORE 11.1.0.7.0 Production"
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production

    Quote Originally Posted by anacedent View Post
    It is bad "design" to store multiple values in a single field/column & now you pay the price.
    Agreed. Unfortunately, I do not own the database/application that has created this mess. Now I'm trying to clean up the data on my end the best I can.

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    bcm@bcm-laptop:~$ cat test.dat
    012313 ServerA|ServerB|ServerC Open
    bcm@bcm-laptop:~$ awk -F\| '{print $1"\n"$2"\n"$3}' test.dat
    012313 ServerA
    ServerB
    ServerC Open
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Mar 2006
    Posts
    56
    Is your problem basically splitting the string by '|'?

    Split a String

Posting Permissions

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