Home > database > Oracle how to split fields and corresponding correlation ID?
Oracle how to split fields and corresponding correlation ID?
Time:09-19
There is a table, save data is probably: ID DESC 1 A, B, C and DE 2 M, LD, D, C 3 H, MM, SD, WE How to split into: ID DESC 1 A 1 B 1 C DE 1 2 M 2 LD 2 D 2 C 3 H 3 MM 3 SD 3 WE Online information are mostly regexp_substr plus connect by implementing a single field, but here is the result of after break up with the corresponding ID Numbers, because the correlation ID is required to obtain corresponding multiline results after break up, Beg god grant instruction!
CodePudding user response:
And id=the prior id
CodePudding user response:
Select id, regexp_substr (des, '[^,] +' 1, level) new_des The from desc_info Connect by level & lt;=regexp_count (des, ', ') + 1 And the prior rowid=rowid And the prior dbms_random. The value is not null; Results: 1 A 1 B 1 C DE 1 2 M 2 LD 2 D 2 C 3 H 3 MM 3 SD 3 WE