Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Spool ???

Status
Not open for further replies.

softdrink

Programmer
Jul 26, 2001
112
CA
I'm trying to print. I save my report as me.sql

How would I send this file to the printer.

thanks,

softdrink
 

Are you using Unix? or Windows? Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
sorry about that, I'm on windows, using SQLPlus

softdrink
 

If you want to automatically print. You can try using the HOST command.

For example;

--me.sql start

SPOOL $ORACLE_HOME\BIN\report.txt

SELECT *
FROM table1;

SPOOL OFF;

HOST('PRINT /D:hpprinter $ORACLE_HOME\BIN\report.txt');

--me.sql end

Is this what you are looking for?
Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
ok, keep in mind that I'm a beginner. Here is what I do
Start me.sql

then...

spool filename.sql

then...
spool out

it does not give me any errors, but it does not print. What am I doing wrong?

softdrink
 


Should be SPOOL OFF not OUT....


It would be better to indicate the directory of the spool file to avoid confusion. Example;

SPOOL C:\TEMP\filename.sql

...

SPOOL OFF


Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
ok, but the name of the file after the spool command is NOT me.sql but any_file_name.sql, right?

softdrink
 

Yes. Any filename will do, length of filename is OS-specific, and any file extension as well. If you forgot to put an extension, not to worry bec Oracle will assign a default of .lst in your file.

Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
I think I'm missing a step, I'm doing this:

@me.sql

when it runs I do this

spool c:\temp\filename.sql

then I enter

spool out

it does not print...any suggestions?

softdrink
 

Your step should be like this.


SQL> SPOOL c:\temp\filename.sql

SQL> @me.sql

SQL> SPOOL OFF


Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
This issue has come up before. See thread186-283738. The "spool out" command is not supported in the Windows environment. If it worked, it would be the easiest way to print a spool file. Since it doesn't, you should take Rcurva's suggestion and terminate spooling with the "spool off" command. Then you can use Notepad or some other editor to open and print the file that is created. At least that's the way I do it. Rcurva's suggestion to use the "host" command may also work.
 
Ok that worked, thanks

lets say that I want to print a report directly from SQLPlus in windows, that will NOT be possible, right. I guess I would have to go throug notepad instead and print it from there.

and thanks for the thread, I will check it as well.

softdrink
 

Printing directly is possible as I have mentioned on earlier posting by using the HOST command.

But it is more convenient to do otherwise.


Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
thanks for all your help, much appreciated.

Last thing, just curious, when I create a new table, where does it get stored in the computer, if so?

softdrink
 

If you create the table inside the Database, and I believe, using sqlplus, the table is stored in your Oracle Database server.

The created table under a tablespace will be physically stored in one of the data files in your database. Usually, if you have a client-server configuration, these files are in the server side.

Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top