It doesn’t export well for text fields with line breaks

Query:

SELECT 1 AS numero, SYSDATE AS fecha_hora, 'Texto
Texto' AS texto, TRUNC(SYSDATE) AS fecha FROM DUAL
UNION
SELECT 2 AS numero, SYSDATE AS fecha_hora, 'Texto 2
Texto 2' AS texto, TRUNC(SYSDATE) AS fecha FROM DUAL

It doesn't export well for text fields with line breaks.

This problem has been around for quite some time.

The query returns 2 records, and when I export it as "Delimited Text" (clipboard), the text with line breaks creates new rows.

When I export it in "Excel Instance" format, it works fine, but the date fields in Excel get formatted as descriptive dates and look different from Toad's grid.

The export I usually use that gives me the data as I see it in Toad is when I use "Delimited Text" (clipboard).
Hopefully you can fix it.

Hi Carlos,

When you export to the Excel File (or Excel Instance) format, Excel understands that a line break can be within a cell.

From your 3rd screen shot, it looks like you are opening your delimited text file in Excel (or pasting the clipboard into Excel). In any case, whatever Excel does in this case does not seem like a bug in Toad to me. Maybe Excel will handle it better if you use the "String Quoting" option (this is just a guess, I didn't try)

I think it is correct for Toad to write a line break into the output when it exists in your data. Do you think it should do something different? If so, what?

-John

The "Delimited Text" export and clipboard (from the example) should work regardless of line breaks that exist in a text within a field. That is, when pasting into Excel, it should respect the rows; it should create 2 rows and no more.

I'll give you a comparison with the same operation in 2 tools (Toad and SQL Developer). With TOAD, 4 rows are generated (because of the line break) and with SQL Developer only 2 rows are generated (which is correct).

Ok, let's forget about Excel for a minute.

The main thing here is that SQL Developer seems to have some options for delimited text that Toad does not. If Toad can give the same options and makes a file with the same format as SQL Dev, then Excel will behave the same with it.

Some questions:

  1. Can I see SQL Dev output (pasted here, not into Excel)?
  2. What are the "Delimitador" options?
  3. Does "Cierre a la izqueirda/derecha" mean for each field or the whole line?
  4. What are the other options for "terminador de linea"?

Thanks

TOAD generates this:

NUMERO FECHA_HORA TEXTO FECHA
1 03/11/2026 14:35:35 Texto
Texto 03/11/2026
2 03/11/2026 14:35:35 Texto 2
Texto 2 03/11/2026

SQL Developer generates this:

"NUMERO" "FECHA_HORA" "TEXTO" "FECHA"
1 03/11/2026 "Texto
Texto" 03/11/2026
2 03/11/2026 "Texto 2
Texto 2" 03/11/2026

I’ve pasted the result in each file. That’s in case you want to see all the characters that are printed. You open it with some editor (notepad++) and turn on 'Show all characters'

data--toad.txt (129 Bytes)

data--sqldev.txt (123 Bytes)

These options in Toad should give you the same thing as SQL Dev.

Excellent John, that worked well for me. It's configurable and it wasn't an error.

Thanks a lot.