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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output Select(*) to File 1

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

I am using Oracle 8.17.4 SQL on a Sun Solaris 8 system from SQLPLus. How can I do a SELECT count(*) <tablename>; and send the total to a file?

My goal is to have a file with just the count and no other syntax or verbiage. In playing with the SqlPlus spool command I get all kinds of syntax besides the number.

Thanks,

Michael42
 
SET HEADING OFF
SET FEEDBACK OFF
SET PAGESIZE 0FF
SPOOL myfile.txt
SELECT * FROM ny_table;
SPOOL OFF;

The only extraneous stuff should be at the top (the query) and the bottom (a prompt and the SPOOL OFF command).
 
carp,

I was abe to use your suggestion along with some UNIX file manipulation tricks to achive the goal.

Thanks for posting,

Michael42
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top