Without programming, can I create a .buf file to run a routine to do a select statement and export it to text or spreadsheet format file for further use? I tried using spool but am doing something wrong.<br><br>thanks
This is what is contained in the buffer. I just run it from the SQL> prompt and <br>i get the following error:<br><br>ERROR at line 5:ORA-00933: SQL command not properly ended<br><br>select costcode,fundcode,program,objectcode,project,<br>earnings,retirement,retirecredit,fica,insurance,health,ltdisab,<br>downdate from ops$vdhperts.payroll where costcode='532' <br>order by costcode, fundcode<br>spool c:\temp\output.txt<br>/
I tried the following and still got an error:<br><br>SQL> run<br> 1 spool c:\temp\output.txt<br> 2 select costcode,fundcode,program,objectcode,project,<br> 3 earnings,retirement,retirecredit,fica,insurance,health,ltdisab,<br> 4 downdate from ops$vdhperts.payroll where costcode='532'<br> 5 order by costcode, fundcode<br> 6* spool off<br>spool c:\temp\output.txt<br>*<br>ERROR at line 1:<br>ORA-00900: invalid SQL statement
I tried that and it still gave me an error. Is "Spool" a command you can use from the buffer or does it have to be within the context of a SQL file? <br><br>Any other ways you can think of to get the data and send it out to a text file from the SQL> prompt?
skapsak -<br>You put your finger right on the problem! I missed the part about this being in your buffer!<br>SPOOL is a SQL*Plus command, so it never goes into your command line buffer - that's reserved for SQL commands.<br>So there's two ways to skin this cat (Mike - that's an Americanism for solving the problem):<br><br>1. From your command line:<br><br>SQL> spool c:\temp\myfile.txt<br>SQL> /<br>SQL> spool off<br><br>This will turn on spooling, run the SQL in your buffer, then turn spooling off.<br><br>OR<br><br>Put the spooling commands along with your SQL in a file and run the file as a script:<br><br>spool c:\temp\myfile.txt<br>SELECT the_rest_of_your_query_here;<br>spool off<br><br>SQL> @my_script_file<br><br>Sorry for being so slow on the uptake here!
I had just figured that out before I got notification that you guys figured it out. Thanks for your help. This is a great service for all of us who are novices.<br><br>Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.