Link to home
Start Free TrialLog in
Avatar of Manjula_Hari
Manjula_Hari

asked on

Spooling in Toad

how do i spool  the output data from a storeprocedure to File.i am using toad with oracle
Avatar of schwertner
schwertner
Flag of Antarctica image

Copy/pasting the output.

Also you can use SQL*Plus or iSQLPLUS and
spool the output:

spool c:\File.i
execute my_pocedure;
spool off
In Toad write your script as below

spool c:\temp\outputfile.txt
exec your_sp;
spool off

Then press F5 or, goto sql editor then select "execute as a script".
set serveroutput on

or, in the "editor"
        right click on the bottom "data grid" tab
        make sure the DBMS_OUTPUT tab is enabled   (ctrl-alt-D)
        click the "green" go button

       
--  then do as sventhan has posted above
spool c:\temp\outputfile.txt
exec your_sp;
spool off
Then press F5 or, goto sql editor then select "execute as a script".
Avatar of Manjula_Hari
Manjula_Hari

ASKER

i need a stored procedure in side which the select statements should be present.i want spool the output of sp to file.is it possible
eg,
PACKAGE PKG_SPOOL IS
 TYPE OUTPUTCURSOR IS REF CURSOR;
 PROCEDURE PARTLIST(OUT_PARTLIST OUT OUTPUTCURSOR);
 procedure SPOOldata(OUT_PARTLIST OUT OUTPUTCURSOR);
END PKG_SPOOL;
/
Create or replace package body PKG_SPOOL as
Procedure PARTLIST(OUT_PARTLIST OUT OUTPUTCURSOR)
AS
BEGIN
open OUT_PARTLIST for SELect VIEW_CODE FROM BILL;
END PARTLIST;
Procedure SPOOldata(OUT_PARTLIST OUT OUTPUTCURSOR)
spool PARTLIST
exec PARTLIST
spool off
end SPOOldata
END PKG_SPOOL;
ASKER CERTIFIED SOLUTION
Avatar of schwertner
schwertner
Flag of Antarctica image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial