Spool size restriction on SQL*Plus

Hi,
I am trying to spool the data from a table to a text file. As the maximum buffer size for spool command is 1000000 in SQL*Plus I am getting BUFFER OVER FLOW error. I know the text file can be created using UTL_file package. Is there any other easy method to capture the data to text file like Spool.
I need to capture nearly 10000 lines (each can have 500 characters).
Thanks,
Vengad

You 'set termout off' before you execute your script for spooling. The buffer overflow error shows up if you want see the results on screen...
By setting 'termout off' the results would not come on the screen.

Similar Messages

  • How can I spool file in SQL*Plus using sysdate as filename?

    Dear Oracle Experts,
    Would you help me to solve following problem?
    I want spool a file in SQL*Plus but using sysdate as filename.
    e.g. today is 30-Nov-1999
    then the filename is 19991130.lst
    tommorrow is 1-Dec-1999
    then the filename is 19991201.lst
    My e-mail address is [email protected]
    Thanks!!!
    Tony Sit
    null

    Tony Sit (guest) wrote:
    : Dear Oracle Experts,
    : Would you help me to solve following problem?
    : I want spool a file in SQL*Plus but using sysdate as filename.
    : e.g. today is 30-Nov-1999
    : then the filename is 19991130.lst
    : tommorrow is 1-Dec-1999
    : then the filename is 19991201.lst
    : My e-mail address is [email protected]
    : Thanks!!!
    : Tony Sit
    Tony, hi!
    Let you test this way:
    set ECHO OFF
    set TERMOUT OFF
    set FEEDBACK OFF
    set VERIFY OFF
    SET PAGESIZE 0
    SET LINESIZE 80
    SET HEADING OFF
    spool setout.sql
    SELECT 'SPOOL '

  • SQL*Plus report: hide accept value in report

    HI all,
    I have created an SQL Report of an APEX-Application. The output is stored in a HTML file.
    All works fine but one think I want to hide in the HTML report.
    I try to describe what the problem is.
    I prompt the user to put in the application_id of the apex application:
                           accept v_application_Id char prompt 'Appliaction-ID:'
    In the HTML file the following output is shown:
    Report created on:
    25-Jun-2013, 10:06:04
    alt 8: where application_id = &&v_application_id
    neu 8: where application_id = 680
    Workspace
    WORKSPACE
    APPLICATION_ID
    APPLICATION_NAME
    ALIAS
    OWNER
    Q0Q0AUFTRAGSVERWALTUNG
    680
    Q0Q0AUFTRAGSVERWALTUNG
    F680317
    Q0Q0AUFTRAGSVERWALTUNG_ADMIN
    How can I hide the two lines
    alt 8: where application_id = &&v_application_id
    neu 8: where application_id = 680
    from the report?
    I have searched  this forum and toke a look into the documentation but I have nothing found.
    Could anyone please help me?
    Oracle 11g R2
    This is the SQL script what I run in SQL*Plus.
    -- start script
    accept v_application_Id char prompt 'Appliaction-ID:'
    spool C:\a\APEX.html
    set termout off
    SET MARKUP HTML ON SPOOL ON HEAD "<TITLE>SQL*Plus APEX-Report</title> -
    <STYLE TYPE=’TEXT/CSS’><!--BODY {bgcolor: ffffaa background: ffffc6} --></STYLE>"
    clear break
    clear buffer
    clear compute
    clear column
    clear sql
    set feedback off
    set serveroutput on
    -- Report Header
    ttitle left ' ' skip 1
    select TO_CHAR(sysdate,'dd-Mon-yyyy, hh24:mm:ss')  "Report created on:"
    from dual;
    -- Workspace
    ttitle left col 15 '<font face="Arial" size="+2" color="#0000FF">Workspace</font>' skip 1
    set linesize 300
    set pagesize 500
    set serveroutput on
    column workspace format a35
    column application_id format 99999999
    column application_name format a35
    column alias format a35
    column owner format a35
         select
             WORKSPACE,
             APPLICATION_ID ,
             APPLICATION_NAME,
             ALIAS,
             OWNER
         from apex_applications
         where application_id = &&v_application_id;
    ttitle off
         select
             APPLICATION_GROUP,
             APPLICATION_GROUP_ID,
             HOME_LINK,
             PAGE_TEMPLATE,
             ERROR_PAGE_TEMPLATE
         from apex_applications
         where application_id = &&v_application_id;
    set termout on
    set markup html off head '' body '' entmap off spool off pre off
    set feedback on
    set linesize 80
    set pagesize 50
    ttitle off
    set termout on
    set serveroutput off
    spool off
    set echo on
    -- End Script
    best regards
    ben
    Oracle 11g R2

    Hi, Ben,
    The SQL*Plus command to stop those messages is
    SET VERIFY OFF
    Put this command anywhere before the first use of a substitution variable, e.g. before the SPOOL command.
    Those "OLD" and "NEW" messages will stay suppressed until you either end the SQL*Plus session, or issue a SET VERIFY ON command.
    If you use SQL*Plus often, then, when you have a few minutes, look up the SET command in the SQL*Plus manual,
    SET System Variable Summary
    and read a little about each option.  You probably won't remember everything, but you probably will remember what kinds of things can be controlled by the SET command, and have a better idea of where to start looking in the future when you have a different problem.

  • Sql*plus missing parenthesis

    hi, experts,
    I use sqlplus to run this command.
    CALL dbms_stats.gather_table_stats(ownname => 'XXXX',tabname => 'XXX_TBL',estimate_percent => dbms_stats.auto_sample_size,cascade => TRUE,degree => dbms_stats.default_degree,method_opt => 'FOR ALL COLUMNS SIZE SKEWONLY')
    the sql*plus version is 9.2.0.1.0
    the database version is 9.2.0.7.0
    is my syntax correct?
    but it returns this error.
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    is the syntax not allowed in sql*plus?

    Hi,
    Forreging wrote:
    Dear Frank Kulash,
    I run this at the SQL> prompt AND on one line
    do you mean this is not allowed to use call directly in SQL*PLUS?No, it's fine in SQL*Plus. I was just saying it won't work in PL/SQL.
    Another way to call it from SQL*Plus is to say EXEC instead of CALL:
    SQL> EXEC dbms_stats.gather_table_stats(ownname => 'XXXX',tabname => 'XXX_TBL');What happens when you call it with just 2 arguments?

  • SQL*Plus spooled filesize restriction

    Hi,
    Are there any restrictions on the size of spooled file frol SQL*Plus session apart from obvious underlying O/S filesize restrictions?
    E.g. Let's say that my O/S supports 4GB filesize are there any restrictions on sqlplus that would prohibit to spool file up to 4GB?

    Are there any restrictions on the size of spooled file frol SQL*Plus session apart from obvious underlying O/S filesize restrictions?AFAIK, no.
    Oracle documentation doesn't say anything about that in Database Limits

  • SQL*Plus - how to suppress the SQL in a spool file

    This is my SQL*Plus script. I thought I had solved the problem, but it is back now and I don't know what I am missing. But I don't want the query at the top of the file.
    SET SERVEROUTPUT ON
    SET MARKUP HTML ON -SILENT
    SET ECHO OFF
    SET PAGESIZE 33
    SET TERMOUT OFF
    Spool C:\DuaneWilson.xls
    SELECT *
    FROM RPT_DS1_CNT_CAT_vw
    WHERE ROWNUM <=100
    ORDER BY CVBI_KEY;
    SET MARKUP HTML OFF
    SET ECHO ON
    SET PAGESIZE 20
    SET TERMOUT ON
    SET SERVEROUTPUT OFF

    It turns out when I run the script with the @ or Start with the file name, there is no SQL put out to the file. But when I just copy the text out of the file and run it at the prompt, the SQL appears in the output file. In reference to the -SILENT, I put that in after the MARKUP statement and got an error. Maybe I don't know where that goes. And I am not sure why there is a difference if it is run as a script or just pasted to the buffer. At least it should be the same in the output file, I would think.

  • Restricting the user to operate DML's from SQL PLUS Environment

    how to Restrict the user to operate DML statements from SQL PLUS Environment.

    Once you restrict SCOTT user to not be able to do an INSERT command, the SQL*Plus returns an error for user SCOTT when he tries to execute an INSERT statement.
    Note however, that this is enforced by SQL*Plus, not the database!
    Look into the use of product_user_profile from Oracle documentation for more information.
    SQL> insert into product_user_profile values('SQL*Plus', 'SCOTT', 'INSERT', NULL, NULL, 'DISABLED', NULL, NULL) ;
    1 row created.
    SQL> commit ;
    Commit complete.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production
    SQL>
    SQL> connect scott
    Enter password:
    Connected.
    SQL>
    SQL> insert into emp select * from emp ;
    SP2-0544: invalid command: insert
    SQL>
    SQL>

  • Seek help to format spool file from SQL*PLUS

    I am running a Unix shell script to call a Oracle 11g SQL script from a Oracle database. In this SQL script, I need to connect to many different remote databases to select data, then sool these records as one big text file to a directory. Then email the file to related Group users. In the spool file, there is a line on the top of each page like this:
    DUMMY
    DB_NAME
    I know this is caused by connect to remote database in SQL*PLUS. My connection string is like this:
    Conn system/password@Oracle_SID
    How can I remove these lines or how to skip these lines into spool file? Please advise. Thanks in advnce. Wish all of you Happy New Year!!!

    Hi,
    It sounds like you have some kind of formatting (such as SQL*Plus TTITLE) producing the output you don't want. If that's the case, temporarily stopping the spooling might not help you. Find out what is causing the output that you don't want. You say that you know it is caused by the CONNECT statements, but it must be more than that. I've written scripts with CONNECT statements that don't have anything like what you reported at the top of each page; in fact, they don't even have pages: the output is one continuous stream. Find out what's putting the unwanted output there, and that will be a big clue as to how you can stop it.
    You say that you know the unwanted titles are there because of the CONNECT statements. If so, use database links instead of CONNECT. You don't have to use dbms_scheduler or utl_file; just eliminate the CONNECT statements. (I'm not saying that there's anything wrong with dbms_scheduler or utl_file; you should definitely investigate those tools. I'm just saying that using database links is independent of them.)
    What would happen if you did all your connecting to different databases at the OS level? Can you write a shell script that connects to each database in turn, and runs a SQL*Plus script in each one. Each SQL*Plus script would have a SPOOL or SPOOL ... APPEND command, or maybe you could build the SPOOL into a LOGIN.SQL script.

  • Specify different location of SQL*PLUS EDIT/SPOOL directory

    Where can I specify the location of the SQL*PLUS edit/spool directory such that I can change it from the default? I'm running on Linux (Ubuntu 6.10) if that helps...

    Check this Link :
    Error while Invoking Editor
    Regds.

  • SQL Plus Error - "Can't open file" when spooling

    Hi:
    I have a user who is either able or unable to spool when running a script depending on what Oracle user she logs in as. She's always logging in as the same Linux user but connecting to Oracle as different Oracle users via SQL Plus. When spool files are created they are created with that user's account and group settings, so the OS account seems to be fine.
    I'm having a problem with the idea that there is an Oracle role or something that controls this. Spool isn't UTL_FILE. Is this a SQL Plus application setting or something?
    We're using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    Thanks

    Well, I'm working off an email so maybe they cut and pasted and maybe they didn't. They say the error is
    spool error: "Cannot create spool file"
    I'll have to recreate their situation and see what it really says. But either way, my confusion is how this same OS user can log in as a different Oracle user and spool away. Perhaps the comment above is correct. It worked the first time and they tried to run under the other account without removing the current file. I tend not to think so because these users have been running similar reports for years and they usually have to remove the old output file before re-running.

  • Spool sql*plus's output

    Hello,
    I want to write all the output of sql*plus in a file, so I did this:
    SQL> SPOOL text.out
    SQL> host date;
    Tue Jan 26 15:46:17 UTC 2010
    SQL> SPOOL OFF
    SQL> exitAnd the output was:
    bash> cat text.out
    SQL> host date;
    SQL> SPOOL OFFSo where is the date in the text.out???
    Thanks for any help!

    The HOST command writes a separate output that is printed on sqlplus screen but is ignored by the spool command.
    The only workaround I can suggest you is the following:
    SQL> host date > a.txt  -- Doing this outside the spool
    SQL> spool a.txt append  -- append mode not to loose the previous content of the file
    SQL> select 1 from dual;
             1
             1
    SQL> spool off
    SQL> host cat a.txt
    Tue Jan 26 17:20:12 CET 2010
    SQL> select 1 from dual;
             1                                                                     
             1                                                                     
    SQL> spool off
    SQL> Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/23/la-forza-del-foglio-di-calcolo-in-una-query-la-clausola-model/]

  • Would like to write SQL code to generate a 'spool' statement in SQL Plus.

    Hi,
    We're using Oracle 11.1.
    I'm spooling data to a file from a SQL Plus shell script .
    The format of the file name they're giving me has the current date on the end, so something like:
    filenameMMDDYYYY.txtWhen I write my spool statement I'd like to do it so that I give it the file name with a formatted sysdate at the end.
    I think I need to generate SQL to do this but I don't have experience in generating SQL.
    How would I do this in a SQL Plus Linux shell script?

    set termout off
    col dt new_value dt
    select to_char(sysdate,'YYYYMMDDHH24MISS') dt from dual;
    set termout on
    spool file_&dt
    Handle:      816567
    Status Level:      Newbie
    Registered:      Nov 29, 2010
    Total Posts:      73
    Total Questions:      30 (20 unresolved)
    so many questions & so few answers.
    Edited by: sb92075 on May 12, 2011 4:27 PM

  • SQL*Plus script with a dynamic SPOOL File Location?

    Anyone,
    I have a numbr of SQL Plus scripts that I need to run many times but each run against a different database. Each script SPOOLS the output like this:
    spool c:\temp\BUILD_ASSET.lis
    spool c:\temp\BUILD_WORKORDER.lis
    etc
    (each spool is a seperate script run)
    The spool is at the top of each BUILD SQL Script.
    Example:
    set time on
    SET FEEDBACK ON
    SET ECHO ON
    SET TIMING ON
    spool c:\temp\BUILD_ASSET.lisBut I need each run to go into its own directory based on the database I am connected to. Like this:
    CONNECT DB1
    @C:\temp\BUILD_ASSET.SQL =====> spool c:\temp\DB1\BUILD_ASSET.lis
    @c:\temp\BUILD_WORKORDER.SQL =====>  spool c:\temp\DB1\BUILD_WORKORDER.lis
    etc
    CONNECT DB2
    @C:\temp\BUILD_ASSET.SQL =====> spool c:\temp\DB2\BUILD_ASSET.lis
    @c:\temp\BUILD_WORKORDER.SQL =====> spool c:\temp\DB2\BUILD_WORKORDER.lisIs there a way to dynaically code this without having to create a version of the BUILD scripts for every single DB I connect to?
    I would like to have one big script that executes all the individual BUILD scripts.
    Seems very easy in concept but I can not see an easy way. I would appreciate any help I can get.
    Thanks in advance,
    Miller

    column db new_Value db
    select sys_context('userenv','db_name') db from dual;
    spool c:\temp\&db\file.lis

  • Turn off sql plus data grid when spooling

    I want to find the function to turn off the data returning to the data grid screen when I am spooling a file.
    I am using sql plus to perform the spooling.
    Thanks you.
    Ricard

    SQL> set termout off

  • SQL Plus command to print a report in Landscape format

    Hi,
    what is the SQL Plus command to print a report in Landscape format?

    841731 wrote:
    Hi,
    what is the SQL Plus command to print a report in Landscape format?SQLPlus doesn't print, and it doesn't know about 'landscape' vs. 'portrait' any more than it knows about fonts. the only 'formatting' it knows is line size, page size. And all it does with line size is know where to insert a CR/LF pair (windows) or a CR (*nix). The only thing it knows to do with page size is repeat column headers.
    The rest is up to whatever application you use to open the pure asciii text spool file.

Maybe you are looking for