1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

sqlplusでCSV出力

Posted at

windowsの場合

SQLサーバはローカルを想定
UTF8のデータを抽出

バッチの中身(UTF8だよと認識させる)
 chcp 65001
 SET NLS_LANG=Japanese_Japan.AL32UTF8
 sqlplus -s oracleID/oraclePASS @ファイル.sql

カラムの中に改行があると、CSV出力される時に改行が入ってしまう
aaaabbbb (aとbの間に改行)

aaaa
bbbb
とCSVに出てしまうので以下を改行が入りそうなところに入れる

select
replace(replace(replace(カラム名, chr(13) || chr(10), ''), chr(10), ''), chr(13), '')

改行コードを別の文字に変換しているので改行されなくなる。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?