Search code examples
encodingsqlplusspool

SPOOL - Format columns with french characters


I am creating a file from a SELECT query using sqlplus with SPOOL command. Some of the columns in my SELECT query have French characters, which are not written properly the file. SELECT RPAD(Column1, ‘ ‘, 32 ) FROM TableX; If the value of Column1 contains for example the character "é", then the output would have length=31 instead of 32 and the "é" char is not correctly shown in output file.

How can I format the columns so that I get proper value and length from my columns?


Solution

  • I found out how to resolve my formating problem. 1. The definition of selected column must be replaced from Column1 VARCHAR2(32 BYTE) to VARCHAR2(32 CHAR); 2. The charset environnemnt variable NLS_LANG must accept french characters: NLS_LANG=FRENCH_FRANCE.WE8ISO8859P15. Thx anyway!