Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can I unload huge data from query to flat file

MDK999Nov 4 2016 — edited Nov 7 2016

Hi

I am using oracle 12.1.0.2

My following query has close to 10 Million records. I need to write the output in text file. What will be the best way to unload this data quickly either in csv or json format?

select

  a.product_id,

  c.product_name,

  a.sensordatavalue,

  to_char(trunc(a.receivedtime),'DD-MM-YYYY HH24:MI:SS') as recd

  to_char(trunc(a.receivedtime),'YYYY') AS recd_yr,

  to_char(trunc(a.receivedtime),'YYYY"-Q"Q') AS recd_qtr,

  to_char(trunc(a.receivedtime),'YYYY"-M"MM') AS recd_month,

  to_char(trunc(a.receivedtime),'YYYYMMDD') AS recd_day

from

  data a,

  product d

where

a.product_id = d.product_id and

and a.receivedtime between to_date('01/01/2016','DD/MM/YYYY') and to_date('31/10/2016', 'DD/MM/YYYY');

Thanks

This post has been answered by AndrewSayer on Nov 6 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 5 2016
Added on Nov 4 2016
30 comments
4,307 views