I will accomplish this in following way:
1. In your operating system script call sqlplus and spool output from your script to a file, let's say myfile.sql. Make sure you prepend the tablename with 'Select count(*) from ' and then append the table with ' ;'. Your sql to do so will be something like: SELECT "Select ' || table_name || ', count(*) from ' || table_name || ' ;' FROM USER_TABLES;". You may use ALL_TABLEs or DBA_TABLES views in place of USER_TABLES depending upon your scope of tables that you want to know the count(*) on. But don't forget to add a where clause if you use ALL_TABLES or DBA_TABLES.
2. Then execute this myfile.sql in your script. This will be outputting to screen output similar to like what you want.
Gurmohan
www.onlymath.com
---------------------------------------------------------------------------------------------
-----Original Message-----
From: bralston
[mailto:oracledba-ezmlmshield-x79985453.[Email address protected]
Sent: Tuesday, May 31, 2005 4:34 PM
To: LazyDBA Discussion
Subject: sql help
I have what is probably a basic sql question. I am pulling a list of tables
that have a name like 'GL%'. I am then wanting to pull a count on each table
in the same clause to get output like this :
Table_name Count
GLMASTER 100
GLNAME 94
GLTRANS 500
Any ideas ???
Brad
This e-mail contains information that may be proprietary in nature or otherwise protected by law from disclosure, and is intended only for the addressee(s) named above. If you are not the addresee, or the person responsible for delivering this to the addressee(s), you are hereby notified that reading, copying or distributing this e-mail is prohibited.
If you have received this e-mail in error, please contact the sender of this e-mail immediately.
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page