Toad World® Forums

CRLF in TOAD editor


#1

When i type some text, using pl\sql, in Editor, for example:

TwoStrings :=
‘string1
string2’;

between string1 and string2 appear one sybol LF ( chr(10) ).

How can i tune TOAD options to insert CRLF ( chr(13) || chr(10) ) instead of one LF??


#2

Morning,

When i type some text, using pl\sql, in Editor, for example:
TwoStrings := ‘string1 string2’; between string1 and string2
appear one sybol LF ( chr(10) ). How can i tune TOAD options
to insert CRLF ( chr(13) || chr(10) ) instead of one LF??

View->Toad Options.
On the left, select FILES/GENERAL.
On the right, check or uncheck (as desired) “Save source files in Unix
format”.

It affects the use of LF or CR/LF in the MOE as well as saving to files.

Cheers,
Norm. [TeamT]

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else. We have checked this email and its attachments for viruses. But you should still check any attachment before opening it. We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes. If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk


#3

It’s not work

I testing using this pl\sql block:

declare
sTmp varchar2(100);
nTmp integer;
begin
sTmp := ‘string1
string2’;
nTmp := instr(sTmp, chr(10));
if nTmp > 0 then
dbms_output.put_line(‘LF’);
end if;
nTmp := instr(sTmp, chr(13));
if nTmp > 0 then
dbms_output.put_line(‘CR’);
end if;
end;


#4

Morning,

It’s not work I testing using this pl\sql block: declare
sTmp dt.LongText; nTmp dt.Reference; begin sTmp := ‘string1
string2’; nTmp := instr(sTmp, chr(10)); if nTmp > 0 then
dbms_output.put_line(‘LF’); end if; nTmp := instr(sTmp,
chr(13)); if nTmp > 0 then dbms_output.put_line(‘CR’); end if; end;

I see what you mean. The other place is in ORACLE/GENEARL (in the
options dialogue) where you have the option of “Newline format for
character data”. However, it still makes no difference - the code in the
MOE always seems to have LF as the end of line character.

I suspect the above is used when reading data from the database and if
that data contains newlines, convert them to the Unix or Windows format.
It doesn’t seem to affect the text in the MOE when I do something like:

some_string VARCHAR2(100) := ‘First line
second line’;

It appears that this format always has Unix style LF line ends.

I suppose you could do something like:

crlf constant char(2) := chr(13) || chr(10);

some_string VARCHAR2(100) := ‘First line’ || crlf || ‘second line’;

But this does mean you cannot split strings over a number of lines as in
your original example. You can do this though:

some_string VARCHAR2(100) := ‘First line’ ||
crlf ||
‘second line’;

Cheers,
Norm. [TeamT]

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else. We have checked this email and its attachments for viruses. But you should still check any attachment before opening it. We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes. If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk


#5

I convert newlines to LF before sending to Oracle. This is probably the cause. Maybe others here with more experience and knowledge can assist. There was a case opened for 8.5 and 8.6 regarding the use of CRLF instead of LF. Consider the following sample code…

CREATE OR REPLACE procedure test
is
begin
EXECUTE immediate ‘declare n number;
BEGIN
select COUNT(1) into n from user_tables;
END;’;
end;
/

When compiled in 8.5/8.6 CRLF would be sent for each newline. This code would execute with ORA-6550 error on some databases, but not all. I can reproduce this problem in 8.5/8.6 on my local database. The case also mentioned that SQLPlus always sends LF so code compiled in SQLPlus always executed without error. I can confirm that on my machine SQL*Plus is always sending LF for newlines.

So, I don’t know if there’s anything that really needs changed here, but if anyone knows of some Oracle setting that should determine newline format then we can revisit this.

Michael