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

  • Home
  • SEARCH
  • 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 695017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:54:58+00:00 2026-05-14T02:54:58+00:00

I’m working on a pl sql stored procedure. What I need is to do

  • 0

I’m working on a pl sql stored procedure.
What I need is to do a select, use a cursor and for every record build a string using values.
At the end I need to write this into a file.
I try to use dbms_output.put_line(“toto”) but the buffer size is to small because I have about 14 millions lines.
I call my procedure from a unix ksh.
I’m thinking at something like using “spool on” (on the ksh side) to dump the result of my procedure, but I don’ know how to do it (if this is possible)

Anyone has any idea?

  • 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-05-14T02:54:58+00:00Added an answer on May 14, 2026 at 2:54 am

    Unless it is really necessary, I would not use a procedure.

    If you call the script using SQLPlus, just put the following into your test.sql (the SETs are from SQLPlus FAQ to remove noise):

    SET ECHO OFF
    SET NEWPAGE 0
    SET SPACE 0
    SET PAGESIZE 0
    SET FEEDBACK OFF
    SET HEADING OFF
    SET TRIMSPOOL ON
    SET TAB OFF
    
    Select owner || ';' || object_name
    From all_objects;
    
    QUIT
    

    and redirect output to a file (test.txt):

    sqlplus user/passwd@instance @ test.sql > test.txt
    

    If you really need to do stuff in PL/SQL, consider putting that into a function and call it per record:

    Create Or Replace Function calculate_my_row( in_some_data In Varchar2 )
      Return Varchar2
    As
    Begin
      Return in_some_data || 'something-complicated';
    End calculate_my_row;
    

    Call:

    Select owner || ';' || calculate_my_row( object_name )
    From all_objects;
    

    Performance could suffer, but it should work. Make sure, that what you try can’t be done in pure SQL, though.


    Reading your comment I think that Analytic Function Lag is what you need.

    This example appends * in case the value of val has changed:

    With x As (
          Select 1 id, 'A' val FROM dual
    Union Select 2 id, 'A' val FROM dual
    Union Select 3 id, 'B' val FROM dual
    Union Select 4 id, 'B' val FROM dual
    )
    --# End of test-data
    Select
      id,
      val,
      Case When ( val <> prev_val Or prev_val Is Null ) Then '*' End As changed
    From (
      Select id, val, Lag( val ) Over ( Order By id ) As prev_val
      From x
    )
    Order By id
    

    Returns

            ID V C
    ---------- - -
             1 A *
             2 A  
             3 B *
             4 B  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I'm making a simple page using Google Maps API 3. My first. One marker
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I need to clean up various Word 'smart' characters in user input, including but

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.