oracle中有多个字符串

时间:2015-04-23 00:02:36

标签: oracle

我想在下表中的oracle中创建多个字符串

http://sqlfiddle.com/#!4/546b1

create table test ( CLIENT varchar(20), DAT varchar(20),SECUENCE varchar(20),COD1 varchar(20),COD2 varchar(20), PERSONAL varchar(20),COMMENTS varchar(140), AREA varchar(20),PHONE varchar(20));
insert into test values ('2869', '17/04/2010 03:12','2','..', '','','drummer Lars Ulrich in a local newspaper.','','');     
insert into test values ('2869', '17/04/2010 03:12','1','..', '','','formed in 1981 when vocalist/guitarist James Hetfield responded to an advertisement posted by','','');     
insert into test values ('2869', '17/04/2010 03:12','0','LS', 'TE','1ABFRN','Metallica is an American heavy metal band formed in Los Angeles, California. Metallica wasadvertisement posted by drummer Lars Ulrich in a,','01442','2236087');
insert into test values ('3532', '18/04/2010 09:20','2','', '','','the expression "relative theory" (German: Relativtheorie) used in 1906 by Max Planck','','');        
insert into test values ('3532', '18/04/2010 09:20','1','', '','','Albert Einstein: special relativity and general relativity The term "theory of relativity" was based on','','');     
insert into test values ('3532', '18/04/2010 09:20','0','LS','TX','1CATAR','The theory of relativity, or simply relativity in physics, usually encompasses two theories by','01871','7142175');

我不知道怎么做,但看看我的主板应该像我下面的附件一样适合我。 任何建议都会感谢您的帮助

|20022869|     17/04/2010 03:12|    8LSFE|  SANDST| paper. ABFRN                    |
|20022869|     17/04/2010 03:12|    7LSFE|  SANDST| d by drummer Lars Ulrich in a local news    |
|20022869|     17/04/2010 03:12|    6LSFE|  SANDST| ield responded to an advertisement poste    |
|20022869|     17/04/2010 03:12|    5LSFE|  SANDST| 1981 when vocalist/guitarist James Hetf     |
|20022869|     17/04/2010 03:12|    4LSFE|  SANDST| ed by drummer Lars Ulrich in a formed in    |
|20022869|     17/04/2010 03:12|    3LSFE|  SANDST| ifornia. Metallica wasadvertisement post    |
|20022869|     17/04/2010 03:12|    2LSFE|  SANDST| vy metal band formed in Los Angeles, Ca     |
|20022869|     17/04/2010 03:12|    1LSFE|  SANDST| 014422236087Metallica is an American hea    |
|20023532|     18/04/2010 09:20|    8LSTX|  SANDST| 06 by Max Planck CATAR              |
|20023532|     18/04/2010 09:20|    7LSTX|  SANDST| ory" (German: Relativtheorie) used in 19    |
|20023532|     18/04/2010 09:20|    6LSTX|  SANDST| as based on the expression "relative the    |
|20023532|     18/04/2010 09:20|    5LSTX|  SANDST| tivity The term "theory of relativity" w    |
|20023532|     18/04/2010 09:20|    4LSTX|  SANDST| ein: special relativity and general rela    |
|20023532|     18/04/2010 09:20|    3LSTX|  SANDST| encompasses two theories by Albert Einst    |
|20023532|     18/04/2010 09:20|    2LSTX|  SANDST| r simply relativity in physics, usually     |
|20023532|     18/04/2010 09:20|    1LSTX|  SANDST|  018717142175 The theory of relativity, o   |

1 个答案:

答案 0 :(得分:0)

这样的事情:

select '|2002'||cast(client as char(4))||'|'||chr(9)||cast(dat as char(20))||'|'||chr(9)
||cast(secuence as char(1))||cast(cod1 as char(2))||cast(cod2 as char(2))||
'|'||chr(9)||cast(personal as char(6))||'|'||chr(9)|| cast((area||phone||' '||comments)
as char(180))||chr(9)||'|'
from test;

但是你的个人6个符号的长度最好,你的例子中代码的长度最好为2个。