Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9172859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:27:14+00:00 2026-06-17T16:27:14+00:00

I have a simple sql script file which only includes a SELECT statement. But

  • 0

I have a simple sql script file which only includes a SELECT statement. But the output of SELECT statement is huge (more than a few hundred thousands lines).

I cannot get output saved in a local file. I just changed my select statement to DESC and it worked fine, so the problem seems the size of output (select statement is something like SELECT * from TABLEX)

I will appreciate any comments on how to execute the select statement..

Thanks in advance


I updated my sql script file as below

SET SQLBLANKLINES ON
set echo off  
set feedback off  
set linesize 1000  
set pagesize 0  
set sqlprompt ''  
set trimspool on  
set headsep off  

spool output.csv  
select * from JM_WCEL_BTH_CURRENT  
SPOOL OFF  
EXIT

The output is below

D:\>sqlplus user/user@mydb @2.sql

SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jan 17 10:10:15 2013

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

  4
  5
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64
bit Production
With the Partitioning, Data Mining and Real Application Testing options

D:\>

There is nothing in the output file but numbers 4 and 5. I ended the process after a few minutes by pressing Ctrl + C. I also tried removing spooling process, there is no output to console as well.

I tried to run the sql query from ay other tool, it gives results in less than a second!

Any suggestions?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:27:15+00:00Added an answer on June 17, 2026 at 4:27 pm

    We have successfully spooled 60 million rows to csv files using SQL*Plus, using something like this:.

    set echo off
    set feedback off
    set linesize 1000
    set pagesize 0
    set sqlprompt ''
    set trimspool on
    set headsep off
    
    spool output.csv
    
    select 'col1,col2,col3' from dual;
    
    select col1 || ',' || col2 || ',' || col3
    from bigtable;
    
    spool off
    

    One problem that can happen with very long-running queries is the Oracle session times out, or the TCP connection gets clobbered by a firewall. If your query runs for hours you should probably look into these issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this very simple sql statement: SELECT max_dose FROM psychotropes WHERE (patient_meds.psychotrope =
I have a simple script which inserts values from a text file into a
I have a SQL script, which spools data to a file. Sample Existing SQL
I have a simple SQL query: Select ID, COUNT(ID) as Selections, OptionName, SUM(Units) as
I have a simple SQL table which defines a set of hierarchical categories and
I have simple SSIS package where I import data from flat file into SQL
I have a sql file containing some sql scripts (DDL and DML) which I
I have an SQL file which I want to parse and execute in oracle
I have a simple SQL query in PostgreSQL 8.3 that grabs a bunch of
I have a simple SQL query (using SqlCommand, SqlTransaction) in .NET 2.0 that returns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.