Split a Database Column into Multiple Rows

Question
I’m handling database data rearrangement these days, and there are two columns like this:

name    leibie
A      Health supplements, Non-drug items, Medical devices, Medical devices (Class I)
B     Medical devices (Class III), Drugs

….
I need to split them into the following form:
name    leibie
A  Health supplements
A  Non-drug items
A  Medical devices
A  Medical devices (Class I)
B  Medical devices (Class III)
B  Drugs

Is there any idea about how to do this? Thanks.

 

Answer
It’s complicated to do it in any database. In this case, it’s simple to handle it in SPL (Structure Process Language). The script consists of only two lines:

A

1

$select name,leibie from TB

2

=A1.news(leibie.split@c();name,~:leibie)

esProc offers JDBC interface to make it function like a database. See How to Call an SPL Script in Java