0

This question is related to separating data from one column and putting it into multiple other columns.

I have a column that hold record data like;

original table called - character_Collection

Columns id,text
id=1 text = ('10596=MAD 10999=THE 11555=HATTER 16666= ')

Yes there is always a space after the equals if there is no Data.

I think I need to use the case commands to move the data to the column.

Oracle DB

Please can someone advise, I would like to make the columns look like;

id first second third fourth 
1   THE   MAD   HATTER null
akirk541
  • 3
  • 4
  • 1
    You would really be much better off using a regular programming language-- this would be difficult in SQL. –  Aug 08 '18 at 17:12
  • 1
    What's the database? The solution is very database-specific. – The Impaler Aug 08 '18 at 17:37
  • this is an Oracle DB – akirk541 Aug 09 '18 at 08:22
  • how did you decide which went into first, second and third? – Randy Aug 09 '18 at 13:29
  • are there always exactly 4 items in the list? – Randy Aug 09 '18 at 13:30
  • No there could be 8-10 but I will always want the same specfic numbers for first second third fourth – akirk541 Aug 09 '18 at 15:00
  • https://stackoverflow.com/questions/2647/how-do-i-split-a-string-so-i-can-access-item-x strongly suggests you need a procedural language to split a string in pure SQL, but that Microsoft SQL 2016 (not Oracle) has such a feature built-in. I don't think you can do what you want in pure standard SQL. –  Aug 09 '18 at 15:56

0 Answers0