问题描述
我需要替换字符串中的chr(10)或chr(13)。然而,我需要排除字符串中间的chr(10)或chr(13)。
例如:
(2S,4R)-1-{1-[ ( 2-乙酰胺基-2-脱氧-γ-D- )
【( 3-{5-[ ( 2-乙酰胺基-2-脱氧-γ-D半乳吡喃基)氧基】戊酰胺基}
5,11,18-三氧代-14-氧杂-6,10,17-三氮烷-29-酰基}-4-羟基吡咯烷-2-
基]甲基全-P-安博-2'-O-甲基-对硫代鸟苷基- ( 3'?5') -2'-O-甲基-对硫脲基- ( 3'?5') -2'-O-甲基胞基1- ( 3'?5') -2'-O-甲基腺酰基-3'
在上面的例子中,我不需要替换位于字符串之间的chr(10)或chr(13)。只需要在字符串的末尾进行替换。请帮忙提供plsql脚本。
谢谢你
例如:
(2S,4R)-1-{1-[ ( 2-乙酰胺基-2-脱氧-γ-D- )
【( 3-{5-[ ( 2-乙酰胺基-2-脱氧-γ-D半乳吡喃基)氧基】戊酰胺基}
5,11,18-三氧代-14-氧杂-6,10,17-三氮烷-29-酰基}-4-羟基吡咯烷-2-
基]甲基全-P-安博-2'-O-甲基-对硫代鸟苷基- ( 3'?5') -2'-O-甲基-对硫脲基- ( 3'?5') -2'-O-甲基胞基1- ( 3'?5') -2'-O-甲基腺酰基-3'
在上面的例子中,我不需要替换位于字符串之间的chr(10)或chr(13)。只需要在字符串的末尾进行替换。请帮忙提供plsql脚本。
谢谢你
专家解答
一个简单的RTIM就可以了。
小球棒
大球棒
小球棒
SQL> create table t ( c clob );
Table created.
SQL>
SQL> insert into t values ('
2 here are several lines
3 of some stuff
4 and there is a chr(10) at the end
5 ');
1 row created.
SQL>
SQL> select c||'x' from t;
C||'X'
---------------------------------------------------
here are several lines
of some stuff
and there is a chr(10) at the end
x
SQL>
SQL> select rtrim(c,chr(10)||chr(13))||'x' from t;
RTRIM(C,CHR(10)||CHR(13))||'X'
---------------------------------------------------
here are several lines
of some stuff
and there is a chr(10) at the endx
大球棒
SQL> create table t ( c clob );
Table created.
SQL>
SQL> declare
2 x clob;
3 begin
4 insert into t values ( empty_clob() )
5 returning c into x;
6 for i in 1 .. 100 loop
7 dbms_lob.writeappend(x,1000,rpad('z',1000,'z'));
8 end loop;
9 dbms_lob.writeappend(x,72,'
10 here are several lines
11 of some stuff
12 and there is a chr(10) at the end
13 ');
14 commit;
15 end;
16 /
PL/SQL procedure successfully completed.
SQL>
SQL> select length(c) from t;
LENGTH(C)
----------
100072
SQL> select rtrim(c,chr(10)||chr(13))||'x' from t;
RTRIM(C,CHR(10)||CHR(13))||'X'
--------------------------------------------------------------------------------
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
...
...
...
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
here are several lines
of some stuff
and there is a chr(10) at the endx
文章转载自askTom,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




