Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue with count query all_tab_columns

User_UMJZ5Feb 27 2017 — edited Feb 28 2017

Hi All,

I'm used below sql script for audit purpose to check the number of records are loaded into Not Null fields of each table..I used the all_tab_columns table because it has all tables columns details in a database and i considered nullable=n for not null columns.Ideally columns defined as not null should not accepts null value but just for audit purpose i have to save the report.when i try the below script it is giving wrong result but still it is giving count as no of columns count .Any one can guide me on this.

SELECT TABLE_NAME,COUNT(*) FROM

(

select table_name,COLUMN_NAME from all_tab_columns

where owner='SH' and nullable='N'--- and table_name='PROMOTIONS'

)

GROUP BY TABLE_NAME

This post has been answered by KayK on Feb 27 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 28 2017
Added on Feb 27 2017
32 comments
3,436 views