1

Using SQL Plus a was able to export data into UTF-8 format as described in Set charset to UTF-8 in SQL*Plus However i need to do this in sql developer as well ?

The idea is to export it like in sql plus with the script not via GUI

@"c\sqlexp\spool_files\export.sql"

How does this looks like is ->

in CMD WIN10 i have set

chcp 65001
set NLS_LANG=.AL32UTF8

then i called scripts to first set parameters

-- disable output on terminal
set term off
set termout off
--set date format that import with FW033 is possible
alter session set NLS_DATE_FORMAT='DD.MM.YYYY HH24:MI:SS';
-- suppress showing sql in result set
set echo off
-- only one header row
set pagesize 0
-- dont display the executed command
set verify off
-- eliminate row count message
set feedback off
-- make line long enough to hold data
set linesize 32767
-- eliminate trailing blanks
set trimspool on
-- eliminate not needed line breaks
clear breaks;
-- enable script name info
set appinfo on
set underline off
set colsep ';'

and then export with spool

@c:\sqlexp\data\RD.sql

spool c:\RD_OUTPUT.sql
    select
    'RD.ID'||';'
    ||'CODE'||';'
    from dual;
    select
    LTRIM(ID)||';'
    ||LTRIM(CODE)||';'
    from RD_AC_ACTION;
    spool off

-> Result with SQL PLUS File in UTF-8 all ok.

If i run this in SQL Developer -> i got ??????? instead of for example ö

1 Answer 1

4

Just use SPOOL. Ensure that Preferences - Environment - Encoding is set to UTF-8.

cd c:\users\jdsmith\desktop
spool beer_emoji.txt
select 'it is 🍺 time' from dual;
spool off

enter image description here

2
  • Thanks. I edited the question -> the idea is to export it like in sql plus with the script not via GUI @"c\sqlexp\spool_files\export.sql"
    – Jeremy
    Commented Mar 10, 2023 at 12:58
  • then edit your question and show how how you're 'exporting' your data in sqlplus, as sqlplus has no export command. It does have a SPOOL... Commented Mar 10, 2023 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.