Spooling procedure output

Hi all,
Could any body please let me know how we can spool a procedure's
output once it is complied.
Like I have a procedure which does a select on 770 records but
I want to know how I can spool this to a flat file.
Is it going to be something like using DBMS_output.put_line
or ....
Could anybody please give me the proper syntax for this .
i also wanna to know how to automatically call the procedure
every one hour.
Thanks a lot in advance.
akkama avanti
null

You could examine the use of the UTL_FILE package which allows
you to write to the OS. You will need to set up the directories
in the initSID.ora to allow certain directories to be used.
To have it automatically execute you can use cron (UNIX) or at
(NT) but I would examine the use of the dbms_job package to see
if this is more suited to your needs.
Jeya Raman R (guest) wrote:
: akkama avanti (guest) wrote:
: : Hi all,
: : Could any body please let me know how we can spool a
: procedure's
: : output once it is complied.
: : Like I have a procedure which does a select on 770 records
but
: : I want to know how I can spool this to a flat file.
: : Is it going to be something like using DBMS_output.put_line
: : or ....
: : Could anybody please give me the proper syntax for this .
: : i also wanna to know how to automatically call the procedure
: : every one hour.
: : Thanks a lot in advance.
: : akkama avanti
: Dear Avanti
: You can not spool in to text file with in a procedure.
: Better you convert your procedure into SQL script.
: In SQL script you give the spool command before the actual
: select statement. It will be spooled in to the specified file.
: To automate a job in UNIX platform you can use cron jobs.
: Better you consult with your Administrator to create a cron
job.
: Feel free to contact for any doubt..
: Jeya Raman R
null

Similar Messages

  • How to Spool the Output of a Cursor to a Flat File?

    I have a SQL script that contains a cursor in it. I'm having trouble with spooling the output of the cursor. Does anyone know of a way to do this?

    Please post the error or problem that you are facing. SQL Script itself would be handy.

  • Purchase order print priview and spool print output are different.

    Hi Friends,
    there is problem with purchase order print priview and spool print output are different.
    mean : in me23n .. for a perticular po .. in po priview the TAX VALUES value is 120 coming..
    when i am giving print with spool.. the amount value is showing  TAX VALUE
    is 443..why it is showing wrong..
    this is for perticular output type.
    why TAX VALUES are showing different in print view and
    spool print.
    help me.
    regards,

    Hi Neil,
    thanks for your reply.
    but the valiadtions are happening in standard functional module PRICING.
    it is realted script(medruck)...but there is no code point for spool or printer side..
    and the issue is realted one PO OUTPUT TYPE..
    it is sap standard debugging... when i am debugging the functional module PRICING.
    the values are coming dynammically.
    help me.
    regards,

  • Send spool id output (sap script) via email in PDF format

    Dear friends,
    Looking for sample program to send spool id output of sapscript via email in PDF format.
    Regards,
    Praveen Lobo

    Hi,
    Try this code..
    * Parameters.
    PARAMETERS: p_email(50) LOWER CASE.
    PARAMETERS: p_spool LIKE tsp01-rqident.
    * Data declarations.
    DATA: plist LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: document_data LIKE sodocchgi1.
    DATA: so_ali LIKE soli OCCURS 100 WITH HEADER LINE.
    DATA: real_type LIKE soodk-objtp.
    DATA: sp_lang LIKE tst01-dlang.
    DATA: line_size TYPE i VALUE 255.
    DATA: v_name LIKE soextreci1-receiver.
    DATA rec_tab LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    * Get the spool data.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    EXPORTING
    rqident = p_spool
    first_line = 1
    last_line = 0
    desired_type = ' '
    IMPORTING
    real_type = real_type
    sp_lang = sp_lang
    TABLES
    buffer = so_ali
    EXCEPTIONS
    no_such_job = 1
    job_contains_no_data = 2
    selection_empty = 3
    no_permission = 4
    can_not_access = 5
    read_error = 6
    type_no_match = 7
    OTHERS = 8.
    * Check the return code.
    IF sy-subrc <> 0.
    MESSAGE s208(00) WITH 'Error'.
    LEAVE LIST-PROCESSING.
    ENDIF.
    * Prepare the data.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 0.
    plist-body_num = 0.
    plist-doc_type = 'RAW'.
    plist-obj_descr = 'Spool data'.
    APPEND plist.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 1.
    DESCRIBE TABLE so_ali LINES plist-body_num.
    plist-doc_type = real_type.
    * Get the size.
    READ TABLE so_ali INDEX plist-body_num.
    plist-doc_size = ( plist-body_num - 1 ) * line_size
    + STRLEN( so_ali ).
    APPEND plist.
    * Move the receiver address.
    MOVE: p_email TO rec_tab-receiver,
    'U' TO rec_tab-rec_type.
    APPEND rec_tab.
    IF NOT sp_lang IS INITIAL.
    document_data-obj_langu = sp_lang.
    ELSE.
    document_data-obj_langu = sy-langu.
    ENDIF.
    v_name = sy-uname.
    * Subject.
    document_data-obj_descr = 'Spool attached'.
    * Send the email.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
    document_data = document_data
    sender_address = v_name
    sender_address_type = 'B'
    TABLES
    packing_list = plist
    contents_bin = so_ali
    receivers = rec_tab
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8.
    IF sy-subrc <> 0.
    MESSAGE e208(00) WITH 'Error in sending email'.
    ENDIF.
    COMMIT WORK.
    * Send the email immediately.
    SUBMIT rsconn01
    WITH mode = 'INT'
    AND RETURN.
    * Success message.
    MESSAGE s208(00) WITH 'Email sent'.
    Thanks
    Naren

  • Spooling the output of a Query with out displaying the rows

    Hello All,
    Is it possible to spool the output of
    a query/dbms_output.put_line with out displaying
    the Query output on the console.
    In my case,list of rows in the output is huge, I want
    to eliminate displaying the output of query
    so that spooling will complete faster.
    Thanks in advance.
    -Srini

    You can do:
    SET TERMOUT OFFIn your script before doing the spool command.
    You will have to write your query as a .SQL script and run it from SQL*Plus in order for it to work the way you expect.
    sqlplus -s username/password @query_script.SQL

  • Data template and procedure output parameters

    Hi all,
    I have multiple sql statements and a MSSQL procedure witch I have to call when generating a report.
    Therefore I use a data template.
    The MSSQL procedure I call with EXEC. It returns the table that it sould return and everything is fine.
    Except: the procedure also returns a punch of OUTPUT parameters and I don't know how to catch those parameters in my data template.
    I have declared all these parameters in the BIP and also in the data template, but there are no values for them when I execute the report.
    Here is a my current data template:
    <dataTemplate name="NameOfTemplate">
    <properties>
      <property name="include_parameters" value="true"/>
    </properties>
    <parameters>
         <parameter name="clientID" dataType="character"/>
         <parameter name="dept" dataType="number" /> <!--This is for MSSQL output-->
         <parameter name="forpay" dataType="number"/> <!--This is for MSSQL output-->
        <parameter name="name" dataType="character"/> <!--This is for MSSQL output-->
    </parameters>
    <dataQuery>
         <sqlStatement name="ARVE" dataSourceRef="connection1">
              <![CDATA[
              select
              from
                   OAP.ACCOUNTS
              where
                   ACCOUNTS.CLIENT_CODE = :clientID
              ]]>
         </sqlStatement>
         <sqlStatement name="ARVE_T" dataSourceRef="connection2" fixedSchema="false">
              <![CDATA[EXEC Dept_proc
                   @ID = :clientID,
                   @Volg =:dept,
                   @Ettemaks =:forpay,
                   @Nimi =:name]]>
        </sqlStatement>
      </dataQuery>
      <dataStructure>
         <group name="ARVE_TULEMUS" source="ARVE">
              <element name="ACCOUNT_SUM" value="SUMMA"/>
         </group>
         <group name="ARVE_TULEMUS" source="ARVE_T">
              <element name="ARVE_NUMBER" value="ARVENUMBER"/>
              <element name="ARVE_KUUPAEV" value="ARVEKUUPAEV"/>
              <element name="ARVE_LEPINGU_SALDO" value="VOLGUSUMMA"/>
         </group>
      </dataStructure>
    </dataTemplate>Where @Volg, @Ettemaks and @Nimi are MSSQL procedure output parameters that I want to show in my report.
    Can anyone give ma an example how to do this?

    Hi all,
    I have multiple sql statements and a MSSQL procedure witch I have to call when generating a report.
    Therefore I use a data template.
    The MSSQL procedure I call with EXEC. It returns the table that it sould return and everything is fine.
    Except: the procedure also returns a punch of OUTPUT parameters and I don't know how to catch those parameters in my data template.
    I have declared all these parameters in the BIP and also in the data template, but there are no values for them when I execute the report.
    Here is a my current data template:
    <dataTemplate name="NameOfTemplate">
    <properties>
      <property name="include_parameters" value="true"/>
    </properties>
    <parameters>
         <parameter name="clientID" dataType="character"/>
         <parameter name="dept" dataType="number" /> <!--This is for MSSQL output-->
         <parameter name="forpay" dataType="number"/> <!--This is for MSSQL output-->
        <parameter name="name" dataType="character"/> <!--This is for MSSQL output-->
    </parameters>
    <dataQuery>
         <sqlStatement name="ARVE" dataSourceRef="connection1">
              <![CDATA[
              select
              from
                   OAP.ACCOUNTS
              where
                   ACCOUNTS.CLIENT_CODE = :clientID
              ]]>
         </sqlStatement>
         <sqlStatement name="ARVE_T" dataSourceRef="connection2" fixedSchema="false">
              <![CDATA[EXEC Dept_proc
                   @ID = :clientID,
                   @Volg =:dept,
                   @Ettemaks =:forpay,
                   @Nimi =:name]]>
        </sqlStatement>
      </dataQuery>
      <dataStructure>
         <group name="ARVE_TULEMUS" source="ARVE">
              <element name="ACCOUNT_SUM" value="SUMMA"/>
         </group>
         <group name="ARVE_TULEMUS" source="ARVE_T">
              <element name="ARVE_NUMBER" value="ARVENUMBER"/>
              <element name="ARVE_KUUPAEV" value="ARVEKUUPAEV"/>
              <element name="ARVE_LEPINGU_SALDO" value="VOLGUSUMMA"/>
         </group>
      </dataStructure>
    </dataTemplate>Where @Volg, @Ettemaks and @Nimi are MSSQL procedure output parameters that I want to show in my report.
    Can anyone give ma an example how to do this?

  • Print priview and spool print output are different

    Hi Friends,
    there is problem with purchase order print priview and spool print output are different.
    mean : in me23n .. for a perticular po .. in po priview one amount value is 120 coming..
    when i am giving print with spool.. the amount value is showing
    is  443..why it is showing wrong..
    this is for perticular output type.
    why perticular values are showing different in print view and
    spool print.
    regards,

    make this setting change:
    in SPAD > In the menu Settings -> Spool System
    In the others tab check the first check box in the Output Controller block, SAVE and exit

  • How to move stored procedure output to file

    Hi All,
    Thanks in advance.
    Please let me know how to move the oracle stored procedure output to the flat file.
    By
    Pyarajan

    Hi Pyarajan,
    As David posted, in the Data Flow Task (DFT), you can add an OLE DB Source, and create a connection manager to connect to the Oracle server using the Microsoft OLE DB for Oracle provider. Then, in the OLE DB Source Editor, you can set the “Data access mode”
    to “SQL command” and input the query to execute your Oracle stored procedure. To export the data to a flat file, we need to add a Flat File Destination to the DFT.
    Besides, also note that you need to install the Oracle client on this server, and you may need to edit the tnsnames.ora and sqlnet.ora files to establish the connection to Oracle successfully.
    References:
    http://commerceserverguy.wordpress.com/2011/12/04/ssis-package-tutorial/ 
    http://sqlblog.com/blogs/jorg_klein/archive/2011/06/09/ssis-connect-to-oracle-on-a-64-bit-machine.aspx 
    Regards,
    Mike Yin
    TechNet Community Support

  • Procedure output as Log files

    Hi all,
    Can any one of you can explain me how to generate the stored procedure output as a ".log" file in oracle ??????
    Thanks in advance,
    Vinay A

    It depends on what you mean by stored procedure output, and on what tool you are using.

  • Spooling queries output to text file

    Hi All,
    I need help to spool the output to a text file for a sequence of queries that I need to execute.
    Lets say, the queries would in a sql file as follows:
    Select * from emp where empId = 1
    Select * from emp where empId = 2
    Select * from emp where empId = 3
    The output in txt file should have the details as
    Employee Id Employee Name Employee Designation
    1 Alex Manager
    2 Conrad Sr Manager
    3 Herman Technical architect.
    I am trying to execute this from sql developer.
    Any pointers in this regard would be highly helpful.

    Hi,
    Welcome to the forum!
    Why not use just one query
    SELECT       *
    FROM       enp
    WHERE       empid     IN (1, 2, 3)
    ORDER BY  empid
    You can use "SPOOL filename APPEND" to re-open and add to an existing spool file after it has been closed, but there's no need to in this case.

  • SPOOLING SQL output using Shell script

    Hi all,
    Is that Possible to Customize the SQL output in EXCEL using SET commandsby spooling
    Desired Output in Excel sheet:
    Counts           Original Query
    236487 Select *..............
    Can anyone plzz help me...Thanks

    Krux_rap wrote:
    Hi all,
    Is that Possible to Customize the SQL output in EXCEL using SET commandsby spooling
    Desired Output in Excel sheet:
    Counts           Original Query
    236487 Select *..............
    Can anyone plzz help me...Thanks
    SQL and PL/SQL FAQ
    What problem are you really trying to solve?

  • Spool List output display 255 chars

    Hi,
    I am execuing the my report in back groung.The oupt list has more than 255 chars.
    could u please let me know how Spool List output display > 255 char when the rpt is run in back ground.
    regards,
    Rayeez.

    Hello,
    Try using the printer formatting as X_65_255.
    Please check this [link|Report is truncating in background; for details.
    BR,
    Suhas

  • Spool and Output Requests

    Hi,
    Can U define what do u mean by spool and output requests(Reporting Agent) and its use in simple words...

    Ash
    Please check this for some more details
    http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a8efb51ea11d189570000e829fbbd/frameset.htm
    Thnaks
    Sat

  • Stored procedure : spool to output file

    i have to spool data from a stored proc to a csv file.I am using dbms_output.put command as i have mulitiple things to put in a row , comma delimited
    My proc looks like this
    create or replace proc xyz
    declare
    cursor c is select x y z .....
    form
    d f f f
    where ....
    variable declaration
    begin
    someting something ..
    for rec in cursor
    loop
    dbms_output.put(x1||',');
    dbms_output.put(x2||',');
    dbms_output.put(x3||',');
    dbms_output.put(x4||',');
    dbms_output.NEW_LINE;
    endloop
    This does not seem to be working ,Can you please tell me the correct way to do so .
    I need a comma delimited file at the end .

    I cannot use util_file .
    I am ussing dbms_output.put . Thats fine .
    i am spooling currently
    I want to know how I can set the SET variables that only the dbms_output.put variables are spooled to the .
    When you do spool get all the command s?.
    Currently i am doing this
    $ORACLE_HOME/bin/sqlplus -s <<EOI
    $CONNECT_STR
    WHENEVER SQLERROR EXIT FAILURE;
    SET FEED OFF TERM OFF
    SET SERVEROUTPUT ON
    SPOOL $SQL_LOG
    BEGIN
    ${PROCESS_SCHEMA_NM}.${STORED_PROC}.CONVERT_FLEX_2_TIMESHEET;
    END;
    is this correct ?

  • How to spool the output of mod pl/sql ?

    I am trying to generate a HTML (will be static after I generate) web page from Oracle PL/SQL package. Moment I execute the package/procedure call, it should generate a HTML file and we will be publishing the file over the web.
    create or replace procedure display_hello
    IS
    begin
    htp.htmlOpen;
    htp.print('Hello World');
    htp.htmlClose;
    end display_hello;
    If I execute the above procedure using PL/SQL Developer, I am able to see the output in the neat HTML fashion. I would like to spool the HTML file used to display that and store it in a file so that i can publish it.
    Any thoughts ?

    vaibhav468 wrote:
    Because we dont want to spoil the performance. Assume our data is not going to change frequently. Say its going to change only once in three days. I dont want people to query the data from the database each time when they open the page. I would like them to just use the static content which i have generated. But the moment the data in my tables are going to get changed, I would run a process and regenerate the page. Not a bad idea ?You can use page caching in mod_psql - have not used it myself, but recall discussions on comp.databases.oracle.server some years ago.
    APEX also sports a cache feature - this is also worthwhile investigating.
    What is a horrible idea though IMO, is to try and roll your own caching - but having PL/SQL code writing physical files to disk for the web server to serve up and at other times creating and streaming content dynamically from PL/SQL code.
    You also need to ask yourself about the actual benefits you will get from caching - and whether that is worthwhile the saving in resources.
    PL/SQL and SQL can be very fast.. with minimal overheads. And this is typically the code that you want to deploy for a web server (as web users expect fast response - a web page should be generated in around 2 secs). In which case it does not matter whether PL/SQL dynamically creates the web page or whether it is provided from a cache - where there is also the overheads of cache logic to consider.

Maybe you are looking for

  • How can I transfer my ipod touch itunes music to my Nexus 7?

    I want to be able to listen to the music that is on my Touch version 2 or 3 to my Nexus 7 tablet and go into the store to get more and manage my account.  I is possible and how do I do it?  Thanks

  • Error In MIRO FI-MM integration

    Hi Gurus, Now i am doing CIN settigns in my project and tax procedure is TAXINN. I done all the configuration steps related to CIN. While doing MIRO, I got errors related to GL acounts. Even GL reconciliation account also not picking here. I maintain

  • Issue in selecting material types as a saleable material

    I have created different material types for finished good , like finished good, trading goods , physician sample , imported physician sample and promo materials. i want at the time of sales all above types of material should be available for sale. ki

  • How to update from MAC OS X 10.5.8

    I need to install iTunes11 but only have MAC OS X 10.5.8 software. All my software updates are current, so so not know what I should download... Thoughts??

  • What the hell is SIGBUS????

    My program quits 1 time out of 2 due to SIGNAL 10 or 11 ( SIGBUS and SIGSEGV ) What the hell are these?? How can I fix them? ( I have Mac OS X 10.3 and use XCode 1.0 )