Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Inserting hyphen changes line-endings

user558000Jul 25 2012 — edited Jul 25 2012
When I run a multi-line insert statement to insert some text in SQL Developer, and the text contains a hyphen ( - ), the line endings all become space-LF, instead of just LF or CRLF. The "Line Terminator" settings in SQL Developer preferences have no effect here.

For example...

Running this insert statement:



INSERT INTO mytab
(mytab_name, mytab_sequence, mytab_label, mytab_image, mytab_text, mytab_comment, mytab_activity_date, mytab_source_ind)
VALUES ('bwskoacc.P_ViewHold', 2, 'DEFAULT', NULL,
'aaa
zzz
aaa'
, NULL, sysdate, 'L');



Results in this dump for the mytab_text field:

Typ=1 Len=11: a,a,a,^J,z,z,z,^J,a,a,a

Note the ^J which is a chr(10) linefeed. This is the dump I expected to see. There are no extra spaces, and the line endings are all just LFs.

Now, compare this insert statement which includes a dash:



INSERT INTO mytab
(mytab_name, mytab_sequence, mytab_label, mytab_image, mytab_text, mytab_comment, mytab_activity_date, mytab_source_ind)
VALUES ('bwskoacc.P_ViewHold', 2, 'DEFAULT', NULL,
'aaa
z-z
aaa'
, NULL, sysdate, 'L');



Results in this dump for the mytab_text field:

Typ=1 Len=13: a,a,a, ,^J,z,-,z, ,^J,a,a,a

Here's the decimal dump:

Typ=1 Len=13: 97,97,97,32,10,122,45,122,32,10,97,97,97

Note the space before each of the linefeeds. Note the length is now 13 instead of 11.
Why is a space being inserted before the linefeeds if I include a hyphen? I have tried inserting all kinds of different text, and found the only thing that has this effect is inserting a hyphen. What's special about a hyphen? Is the database adding the spaces, or is SQL Developer telling the database to add the spaces?


This is how the mytab_text field is defined:

mytab_TEXT VARCHAR2(2000 CHAR)


Thanks!

Edited by: user558000 on Jul 25, 2012 8:59 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2012
Added on Jul 25 2012
4 comments
1,357 views