拆字符串成多记录

【问题】
I use Version: Luna Service Release 1 (4.4.1)

Build id: 20140925-1800

Could you tell me how, for each line, how to cut the line in terms of space and put each value on another line

My table:
ID ANOMALIES
3903 B1 D1 CAT1
3904 D7 D2 B1 CAD4

I would like to:
ID ANOMALIES
3903 B1
3903 D1
3903 CAT1
3904 D7
3904 B1
3904 D2
3904 CAD4

I am Beginner and I have a lot of difficulties with the declaration and use array, I don’t understand when and how filling an array
Could you help me?

Thank You, have a nice day
Pierre

【回答】
用存储过程可以将字段拆分为多条记录,但代码复杂不易编写,这种情况可以用 SPL 实现,脚本如下:



A

1

$select * from data

2

=A1.news(ANOMALIES.split(" ");ID:ID,~:ANOMALIES)

A1:读取 data 表

1png
A2:将 ANOMALIES 字段值用空格拆分成序列,合并生成新的序表
2png