0

我正在使用 SQL Plus 11.1.0.6.0 运行一个脚本,该脚本将批量插入到 Oracle 10g 数据库中。我注意到的问题是,将一些代码字符串插入到包含尾随空格的某些行的 clob 字段中时,例如:

....public void myMethod().... --trailing space here
....{
........int myVar = 1;
........ -- empty line with trailing spaces
........myVar+=1
....}

插入表中的字符串会丢失空行中的那些空尾空格并变为:

....public void myMethod() --trailing space is lost
....{
........int myVar = 1;
-- empty line without trailing spaces
........myVar+=1
....}

尽管它对有用的数据没有影响,但这非常令人沮丧,因为它会导致数据与原始数据不同并且无法通过一些测试。

我能找到的只是 SET TRIMSPOOL/TRIMOUT OFF 这不会改变任何东西,有人有其他想法吗?

4

3 回答 3

0

You can try to enable following parameter:

SET SQLBLANKLINES ON
于 2014-09-19T14:24:16.127 回答
0

最后我通过这样的黑客解决了它(考虑原始示例):

declare
myLargeValue_2 clob;
begin
myLargeValue_2 := '....public void myMethod()'||'....
'||'....{
........int myVar = 1;
'||'........' -- empty line with trailing spaces

and so on

基本上明确地连接了所有的空格

于 2009-10-22T12:02:45.620 回答
0

如果不发布您的脚本就很难确定,但您可能不应该将文本字符串直接插入到 SQL Plus 中的 CLOB 中。如果您要使用从文件中提取文本并从 SQL Plus 调用 PL/SQL 的 PL/SQL 过程,它应该保留所有格式。

但这可能是一个全能的 PITA。但它在 O'Reilly PL/SQL 文本中有很好的记录。

于 2009-10-21T17:26:44.877 回答