LoginSignup
9

More than 5 years have passed since last update.

ORACLEの機能を使って、複数レコードのデータを1レコードのCSVデータにする

Posted at

ORACLEの機能を使って、複数レコードのデータを1レコードのCSVデータにする

  • データを縦横変換しつつCSVデータにしたい場合のスクリプト
SQL

-- 複数レコードのデータを、カンマ区切りの1レコードに出力する方法
SELECT
    LISTAGG(DATA_COL,',') WITHIN GROUP (order by DATA_COL) AS CONCAT_NAME
FROM
    SAMPLE_TABLE
/

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
9