【发布时间】:2017-09-16 00:32:29
【问题描述】:
我有一张与 Oracle 12c 中旧终端系统的订单相关的注释表。每个订单参考都有几行注释,按序号排序。
我想将每个订单参考的所有相关注释连接在一起,以便我可以尝试从中提取一些地址数据。地址数据可以分布在几个不同的序列号上。结构是:
| SEQ | NOTE_TEXT | ORDER | ... |
|-----|--------------------------|-------|-----|
| 1 | The address for this | | |
| 2 | is 123 The Street, City, | | |
| 3 | County, Postcode | | |
| 1 | This customer has ordered| | |
| 2 | this product on date | | |
| 1 | Some other note | | |
| 1 | This order is for A Smith| | |
| 2 | The address is 4 The Lane| | |
| 3 | City, County, Postcode | | |
------------------------------------------------
我想把它变成:
|--------|---------------------------------------------------------------------------|
| ORDER | NOTE_TEXT |
|--------|---------------------------------------------------------------------------|
| ABC123 | The address for this is 123 The Street, City, County, Postcode |
| DEF456 | This customer has ordered this product on date |
| GHI789 | Some other note |
| JKL012 | This order is for A Smith The address is 4 A Lane, City, County, Postcode |
|--------|---------------------------------------------------------------------------|
在连接之前修剪每个注释行可能会很好,但我还需要确保在两行的连接之间放置一个空格,以防有人用文本填充了整行。哦,顺序有问题,所以我也需要先订购。
感谢您的帮助!
【问题讨论】: