Missing CR symbol

Artemko

Member
Hi.
Sometimes we insert/update records via "Edit data" in "SQL window".
Yesterday we were very surprised that multi-line strings in Varchar2 fields are saved without CR symbol this way. My colleague could only find a topic here that explains why plsqldev shows CR symbol in large object editor's hex mode. But I was not able to find an explanation why CR symbol is gone when editing data.
I've also tried Oracle SQL Developer and SQL*Plus in some way. It seems that they are using only LF as a newline symbol too.
The database is running on linux.
Finally I managed to perform update via self-coded app that uses oracle direct connect (ODAC). And I got CRLF in the table.
Can anybody give me a hint on this?
 
The LF character is the standard line terminator/separator in Oracle. When using Windows tools, where CR/LF pairs are the standard, the CR is stripped when posting data to the database. There is currently no option to preserve the CR.
 
But ODAC preserves:

uses
Windows, Classes, SysUtils, Ora (*, *** *);
var
gSQL: TStringList;
gOraQuery: TOraQuery;
begin
gSQL := TStringList.Create;
gSQL.LoadFromFile('query.sql'); //contains update statement with CR/LF
gOraQuery := TOraQuery.Create(nil);
gOraQuery.Session := TOraSession.Create(gOraQuery);
gOraQuery.Session.Options.Direct := TRUE; //important
(* server, user, password *)
gOraQuery.Session.Open;
gOraQuery.SQL.Clear;
gOraQuery.SQL.AddStrings(gSQL);
gOraQuery.Open;
gOraQuery.Close;
gOraQuery.Session.Close;
end;

I believe stripping CR has something to do with OCI.
So, we just keep that in mind?
 
Back
Top